Schemas
OasIntersection
An allOf that keeps at least one reference: a value matches every member.
Core merges the members of an allOf into one schema. A reference that skmtc.config.json parse.intersections keeps is not merged: the schema is an OasIntersection of the kept references, and at most one other member, which the other members of the allOf merge into. By default those are the references that close a cycle.
Signature
import { OasIntersection } from '@skmtc/core'
class OasIntersection extends OasBaseExamples
// LineString: { allOf: [{ $ref: Geometry }, { properties: { coordinates } }] },
// where a property of Geometry leads back to LineString
lineString.members // [OasRef Geometry, OasObject { coordinates }]Constructor
constructor
constructor(fields: IntersectionFields, context?: ParseContextType)Properties
Object is part the 'schema' set which is used to define data types in an OpenAPI document.
Constant value 'intersection' useful for type narrowing and tagged unions.
A short summary of the intersection.
A description of the intersection.
External documentation for the intersection.
Indicates whether the value can be null.
Whether the value is sent by the API only.
Whether the value is sent in a request only.
Whether the value is deprecated.
The schemas, or references to schemas, that a value matches all of.
Specification Extension fields
An example of the value.
The default value.
The schema's not, kept as an OasUnknown under skmtc.config.json parse.not: unknown. undefined otherwise.
Methods
isRef
isRef(): this is OasRef<'schema'>isReadOnly
isReadOnly(): booleanWhether the value is readOnly: the intersection or one of its members is.
isWriteOnly
isWriteOnly(): booleanWhether the value is writeOnly: the intersection or one of its members is.
toParts
toParts(): Exclude<OasSchema, OasIntersection>[]The schemas a value matches all of, with each reference resolved and each intersection inside replaced by its own members. Each is given once, so a member that leads back to an intersection ends. A reference that names nothing is left out.
toTargetParts
toTargetParts(): Exclude<OasSchema, OasIntersection>[]toParts without the keywords next to the references. clone reads these while a reference to this intersection resolves, so no reference may be resolved with its keywords here.
clone
clone(ref?: OasRef<'schema'>): OasIntersectionA copy of this schema with what ref adds at its site applied, as OasUnion.clone does: the keywords that this type takes, a sibling's value winning. The keywords of an object next to ref (properties, required) are one more member, unless the members say the same. This schema does not change, and the copy shares its members.
traverse
traverse(path: SchemaPath): OasSchema | OasRef<'schema'>resolve
resolve(): OasIntersectionresolveOnce
resolveOnce(): OasIntersectiontoJsonSchema
toJsonSchema(options: ToJsonSchemaOptions): OpenAPIV3.NonArraySchemaObject