master-zapier-plan-draft/vendor/zapier-platform/packages/schema/lib/schemas/AuthFieldsSchema.js
George Lambert b4150c8250 Milestone 0: import zappier billing, Verae middleware, and Zapier research
Compose-ready workspace: packages/zappier (rate card, portal, Stripe),
packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier
(CLI app), vendor/zapier-platform, and research/zapier vendor corpus.

Gate 0 structure checks pass. Product code and research are not yet wired.
2026-09-09 02:37:36 -04:00

67 lines
1.9 KiB
JavaScript

'use strict';
const makeSchema = require('../utils/makeSchema');
const AuthFieldSchema = require('./AuthFieldSchema');
module.exports = makeSchema(
{
id: '/AuthFieldsSchema',
description: 'An array or collection of authentication fields.',
type: 'array',
items: {
oneOf: [{ $ref: AuthFieldSchema.id }],
},
// Some complete examples
examples: [
// 1) Basic Auth: username (safe) + password (not safe)
[
{ key: 'username', type: 'string', isNoSecret: true, required: true },
{
key: 'password',
type: 'password',
isNoSecret: false,
required: true,
},
],
// 2) Just a single auth field for custom usage (e.g., api_key)
[{ key: 'api_key', type: 'string', isNoSecret: false, required: true }],
// 3) Mix of fields for extended usage
[
{ key: 'email', type: 'string', isNoSecret: true },
{ key: 'password', type: 'password', required: true },
{ key: 'mfa_token', type: 'string', isNoSecret: false },
],
],
// Anti-examples showing invalid arrays or invalid field objects
antiExamples: [
{
example: {},
reason: 'Must be an array (currently an object).',
},
{
example: [{ key: 'password', isNoSecret: true }],
reason:
'"password" is a sensitive field and cannot have isNoSecret set as true.',
},
{
example: [{ key: 'api_key', isNoSecret: true }],
reason:
'"api_key" is a sensitive field and cannot have isNoSecret set as true.',
},
{
example: [{ isNoSecret: false }],
reason: 'Missing required "key" property.',
},
{
example: [{ key: 'username', type: 'string', isNoSecret: true }, 12345],
reason:
'Array item 12345 is not an object (must match AuthFieldSchema).',
},
],
},
[AuthFieldSchema],
);