@mochabug/adaptkit
Version:
A cmd to create, emulate and publish Mochabug Adapt plugins
401 lines • 17 kB
TypeScript
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
import type { StructJson } from "@bufbuild/protobuf/wkt";
import type { JsonObject, Message } from "@bufbuild/protobuf";
/**
* Describes the file mochabugapis/adapt/graph/jtd_schema.proto.
*/
export declare const file_mochabugapis_adapt_graph_jtd_schema: GenFile;
/**
* Schema represents a JSON Typedef Schema (RFC 8927).
*
* ## Eight Mutually Exclusive Forms
*
* A JTD schema must take exactly ONE of these forms:
* 1. **Empty**: No form-specific keywords (accepts anything)
* 2. **Ref**: Has `ref` keyword
* 3. **Type**: Has `type` keyword
* 4. **Enum**: Has `enum` keyword (non-empty array)
* 5. **Elements**: Has `elements` keyword
* 6. **Properties**: Has `properties` and/or `optional_properties`
* 7. **Values**: Has `values` keyword
* 8. **Discriminator**: Has `discriminator` and `mapping` keywords
*
* ## Shared Keywords
*
* These can appear on ANY form:
* - `nullable`: Allows null values in addition to the schema's type
* - `metadata`: Arbitrary information (ignored during validation)
*
* ## Root-Level Keyword
*
* - `definitions`: Per RFC 8927 Section 2.1, this should only appear on root schemas.
* While this cannot be enforced at the protobuf schema level, application code should
* only populate this field on root schemas, not on nested schemas within definitions,
* elements, properties, etc.
*
* @generated from message mochabugapis.adapt.graph.JTDSchema
*/
export type JTDSchema = Message<"mochabugapis.adapt.graph.JTDSchema"> & {
/**
* The definitions keyword MUST be an object where each value is a schema.
* This object defines a collection of schema definitions that can be referenced via the ref keyword.
*
* RFC 8927 Section 2.1: definitions should only appear on root schemas, not on nested schemas.
* Application code is responsible for enforcing this constraint.
*
* @generated from field: map<string, mochabugapis.adapt.graph.JTDSchema> definitions = 1;
*/
definitions: {
[]: JTDSchema;
};
/**
* The metadata keyword MUST be an object.
* This object is ignored during validation and can store custom information about the schema.
* Examples: descriptions, UI hints, code generation directives.
*
* @generated from field: optional google.protobuf.Struct metadata = 2;
*/
metadata?: JsonObject;
/**
* The nullable keyword MUST be a boolean.
* If true, the schema matches the value null as well as any value matched by the rest of the schema.
*
* RFC 8927: nullable can appear on any schema form.
* Exception: Cannot be true on schemas within discriminator mappings (validated via CEL).
*
* @generated from field: optional bool nullable = 3;
*/
nullable?: boolean;
/**
* The ref keyword MUST be a string.
* It is a reference to a schema defined in the definitions object of the root schema.
*
* RFC 8927 Section 2.2.2: The value must refer to a definition in the root schema's definitions.
* The referenced definition must exist (validated at runtime, not enforceable in protobuf schema).
*
* @generated from field: optional string ref = 4;
*/
ref?: string;
/**
* The type keyword MUST be one of the predefined strings specifying the type of the value.
* Valid values per RFC 8927 Section 2.2.3:
* - "boolean": JSON true or false
* - "float32", "float64": JSON numbers (IEEE 754 single/double precision intent)
* - "int8": -128 to 127
* - "uint8": 0 to 255
* - "int16": -32,768 to 32,767
* - "uint16": 0 to 65,535
* - "int32": -2,147,483,648 to 2,147,483,647
* - "uint32": 0 to 4,294,967,295
* - "string": JSON string
* - "timestamp": RFC 3339 timestamp string
*
* Note: RFC 8927 intentionally omits int64/uint64 due to JSON interoperability concerns.
*
* @generated from field: optional string type = 5;
*/
type?: string;
/**
* The enum keyword MUST be a non-empty array of strings.
* The schema matches any value that is equal to one of the elements in the array.
*
* RFC 8927 Section 2.2.4:
* - When using enum form, this array MUST be non-empty
* - The array MUST NOT contain duplicate values (enforced via unique constraint)
* - Only string enums are supported (no numeric enums)
*
* @generated from field: repeated string enum = 6;
*/
enum: string[];
/**
* The elements keyword MUST be a schema.
* It is used to validate elements in an array.
*
* RFC 8927 Section 2.2.5: Describes homogeneous arrays where all elements match the same schema.
* Empty arrays are valid. Each element is validated against this schema.
*
* @generated from field: optional mochabugapis.adapt.graph.JTDSchema elements = 7;
*/
elements?: JTDSchema;
/**
* The properties keyword MUST be an object where each value is a schema.
* Each key is a required property that must match the corresponding schema.
*
* RFC 8927 Section 2.2.6: Properties form describes JSON objects used as structs.
* - All properties listed here are REQUIRED
* - For optional properties, use optional_properties
* - Keys cannot overlap between properties and optional_properties (validated via CEL)
*
* @generated from field: map<string, mochabugapis.adapt.graph.JTDSchema> properties = 8;
*/
properties: {
[]: JTDSchema;
};
/**
* The optional_properties keyword MUST be an object where each value is a schema.
* Each key is an optional property that, if present, must match the corresponding schema.
*
* RFC 8927 Section 2.2.6: Properties form describes JSON objects used as structs.
* - All properties listed here are OPTIONAL
* - For required properties, use properties
* - Keys cannot overlap between properties and optional_properties (validated via CEL)
*
* @generated from field: map<string, mochabugapis.adapt.graph.JTDSchema> optional_properties = 9;
*/
optionalProperties: {
[]: JTDSchema;
};
/**
* The additional_properties keyword MUST be a boolean.
* If true, the object may have properties other than those specified in properties and optional_properties.
*
* RFC 8927 Section 3.1:
* - Only valid on schemas of the "properties" form
* - Controls "allow additional properties" mode during validation
* - Does not get inherited by subschemas
* - If false or absent, unknown properties cause validation errors
*
* @generated from field: optional bool additional_properties = 10;
*/
additionalProperties?: boolean;
/**
* The values keyword MUST be a schema.
* It is used to validate the values in an object (dictionary/map/associative array pattern).
*
* RFC 8927 Section 2.2.7: Values form describes JSON objects used as dictionaries.
* - Keys can be any string
* - All values must match this schema
* - Empty objects are valid
*
* @generated from field: optional mochabugapis.adapt.graph.JTDSchema values = 11;
*/
values?: JTDSchema;
/**
* The discriminator keyword MUST be a string.
* It is used with mapping to represent tagged unions (discriminated unions, sum types).
*
* RFC 8927 Section 2.2.8: Discriminator form describes tagged unions.
* - The discriminator is a property name that acts as the "tag"
* - The tag value determines which schema from mapping is used
* - Must be used together with mapping (validated via CEL)
*
* @generated from field: optional string discriminator = 12;
*/
discriminator?: string;
/**
* The mapping keyword MUST be an object where each value is a schema.
* Used with discriminator for tagged unions, mapping discriminator tag values to schemas.
*
* RFC 8927 Section 2.2.8: Each schema in mapping:
* - MUST be of the "properties" form (have properties and/or optional_properties)
* - MUST NOT have nullable=true
* - MUST NOT include the discriminator tag in properties or optional_properties
* These constraints are validated via CEL rules below.
*
* @generated from field: map<string, mochabugapis.adapt.graph.JTDSchema> mapping = 13;
*/
mapping: {
[]: JTDSchema;
};
};
/**
* Schema represents a JSON Typedef Schema (RFC 8927).
*
* ## Eight Mutually Exclusive Forms
*
* A JTD schema must take exactly ONE of these forms:
* 1. **Empty**: No form-specific keywords (accepts anything)
* 2. **Ref**: Has `ref` keyword
* 3. **Type**: Has `type` keyword
* 4. **Enum**: Has `enum` keyword (non-empty array)
* 5. **Elements**: Has `elements` keyword
* 6. **Properties**: Has `properties` and/or `optional_properties`
* 7. **Values**: Has `values` keyword
* 8. **Discriminator**: Has `discriminator` and `mapping` keywords
*
* ## Shared Keywords
*
* These can appear on ANY form:
* - `nullable`: Allows null values in addition to the schema's type
* - `metadata`: Arbitrary information (ignored during validation)
*
* ## Root-Level Keyword
*
* - `definitions`: Per RFC 8927 Section 2.1, this should only appear on root schemas.
* While this cannot be enforced at the protobuf schema level, application code should
* only populate this field on root schemas, not on nested schemas within definitions,
* elements, properties, etc.
*
* @generated from message mochabugapis.adapt.graph.JTDSchema
*/
export type JTDSchemaJson = {
/**
* The definitions keyword MUST be an object where each value is a schema.
* This object defines a collection of schema definitions that can be referenced via the ref keyword.
*
* RFC 8927 Section 2.1: definitions should only appear on root schemas, not on nested schemas.
* Application code is responsible for enforcing this constraint.
*
* @generated from field: map<string, mochabugapis.adapt.graph.JTDSchema> definitions = 1;
*/
definitions?: {
[]: JTDSchemaJson;
};
/**
* The metadata keyword MUST be an object.
* This object is ignored during validation and can store custom information about the schema.
* Examples: descriptions, UI hints, code generation directives.
*
* @generated from field: optional google.protobuf.Struct metadata = 2;
*/
metadata?: StructJson;
/**
* The nullable keyword MUST be a boolean.
* If true, the schema matches the value null as well as any value matched by the rest of the schema.
*
* RFC 8927: nullable can appear on any schema form.
* Exception: Cannot be true on schemas within discriminator mappings (validated via CEL).
*
* @generated from field: optional bool nullable = 3;
*/
nullable?: boolean;
/**
* The ref keyword MUST be a string.
* It is a reference to a schema defined in the definitions object of the root schema.
*
* RFC 8927 Section 2.2.2: The value must refer to a definition in the root schema's definitions.
* The referenced definition must exist (validated at runtime, not enforceable in protobuf schema).
*
* @generated from field: optional string ref = 4;
*/
ref?: string;
/**
* The type keyword MUST be one of the predefined strings specifying the type of the value.
* Valid values per RFC 8927 Section 2.2.3:
* - "boolean": JSON true or false
* - "float32", "float64": JSON numbers (IEEE 754 single/double precision intent)
* - "int8": -128 to 127
* - "uint8": 0 to 255
* - "int16": -32,768 to 32,767
* - "uint16": 0 to 65,535
* - "int32": -2,147,483,648 to 2,147,483,647
* - "uint32": 0 to 4,294,967,295
* - "string": JSON string
* - "timestamp": RFC 3339 timestamp string
*
* Note: RFC 8927 intentionally omits int64/uint64 due to JSON interoperability concerns.
*
* @generated from field: optional string type = 5;
*/
type?: string;
/**
* The enum keyword MUST be a non-empty array of strings.
* The schema matches any value that is equal to one of the elements in the array.
*
* RFC 8927 Section 2.2.4:
* - When using enum form, this array MUST be non-empty
* - The array MUST NOT contain duplicate values (enforced via unique constraint)
* - Only string enums are supported (no numeric enums)
*
* @generated from field: repeated string enum = 6;
*/
enum?: string[];
/**
* The elements keyword MUST be a schema.
* It is used to validate elements in an array.
*
* RFC 8927 Section 2.2.5: Describes homogeneous arrays where all elements match the same schema.
* Empty arrays are valid. Each element is validated against this schema.
*
* @generated from field: optional mochabugapis.adapt.graph.JTDSchema elements = 7;
*/
elements?: JTDSchemaJson;
/**
* The properties keyword MUST be an object where each value is a schema.
* Each key is a required property that must match the corresponding schema.
*
* RFC 8927 Section 2.2.6: Properties form describes JSON objects used as structs.
* - All properties listed here are REQUIRED
* - For optional properties, use optional_properties
* - Keys cannot overlap between properties and optional_properties (validated via CEL)
*
* @generated from field: map<string, mochabugapis.adapt.graph.JTDSchema> properties = 8;
*/
properties?: {
[]: JTDSchemaJson;
};
/**
* The optional_properties keyword MUST be an object where each value is a schema.
* Each key is an optional property that, if present, must match the corresponding schema.
*
* RFC 8927 Section 2.2.6: Properties form describes JSON objects used as structs.
* - All properties listed here are OPTIONAL
* - For required properties, use properties
* - Keys cannot overlap between properties and optional_properties (validated via CEL)
*
* @generated from field: map<string, mochabugapis.adapt.graph.JTDSchema> optional_properties = 9;
*/
optionalProperties?: {
[]: JTDSchemaJson;
};
/**
* The additional_properties keyword MUST be a boolean.
* If true, the object may have properties other than those specified in properties and optional_properties.
*
* RFC 8927 Section 3.1:
* - Only valid on schemas of the "properties" form
* - Controls "allow additional properties" mode during validation
* - Does not get inherited by subschemas
* - If false or absent, unknown properties cause validation errors
*
* @generated from field: optional bool additional_properties = 10;
*/
additionalProperties?: boolean;
/**
* The values keyword MUST be a schema.
* It is used to validate the values in an object (dictionary/map/associative array pattern).
*
* RFC 8927 Section 2.2.7: Values form describes JSON objects used as dictionaries.
* - Keys can be any string
* - All values must match this schema
* - Empty objects are valid
*
* @generated from field: optional mochabugapis.adapt.graph.JTDSchema values = 11;
*/
values?: JTDSchemaJson;
/**
* The discriminator keyword MUST be a string.
* It is used with mapping to represent tagged unions (discriminated unions, sum types).
*
* RFC 8927 Section 2.2.8: Discriminator form describes tagged unions.
* - The discriminator is a property name that acts as the "tag"
* - The tag value determines which schema from mapping is used
* - Must be used together with mapping (validated via CEL)
*
* @generated from field: optional string discriminator = 12;
*/
discriminator?: string;
/**
* The mapping keyword MUST be an object where each value is a schema.
* Used with discriminator for tagged unions, mapping discriminator tag values to schemas.
*
* RFC 8927 Section 2.2.8: Each schema in mapping:
* - MUST be of the "properties" form (have properties and/or optional_properties)
* - MUST NOT have nullable=true
* - MUST NOT include the discriminator tag in properties or optional_properties
* These constraints are validated via CEL rules below.
*
* @generated from field: map<string, mochabugapis.adapt.graph.JTDSchema> mapping = 13;
*/
mapping?: {
[]: JTDSchemaJson;
};
};
/**
* Describes the message mochabugapis.adapt.graph.JTDSchema.
* Use `create(JTDSchemaSchema)` to create a new message.
*/
export declare const JTDSchemaSchema: GenMessage<JTDSchema, {
jsonType: JTDSchemaJson;
}>;
//# sourceMappingURL=jtd_schema_pb.d.ts.map