UNPKG

@azure-tools/codemodel-v3

Version:
165 lines 5.55 kB
import { ExternalDocumentation, ImplementationDetails, LanguageDetails } from './components'; import { Extensions } from './extensions'; import { DeepPartial } from '@azure-tools/codegen'; import { Dictionary } from '@azure-tools/linq'; export interface PropertyDetails extends ImplementationDetails { required: boolean; readOnly: boolean; } export interface EnumValue { value: any; description: string; name: string; } export interface EnumDetails { modelAsString: boolean; values: Array<EnumValue>; name: string; } export declare enum Purpose { Header = "Header" } export interface VirtualProperty { /** The property that this represents */ property: Property; /** The things that went into building the name */ nameComponents: Array<string>; /** Names To use in priority order */ nameOptions: Array<string>; /** the name of this virtual property */ name: string; /** the member that should be called to get to the virtual property. (may be recursive) */ accessViaProperty?: VirtualProperty; accessViaMember?: VirtualProperty; /** the member's schema */ accessViaSchema?: Schema; originalContainingSchema: Schema; private?: boolean; alias: Array<string>; description: string; format?: PropertyFormat; required: boolean; sharedWith?: Array<VirtualProperty>; } interface PropertyFormat { suppressFormat?: boolean; index?: number; width?: number; label?: string; } export interface VirtualProperties { owned: Array<VirtualProperty>; inherited: Array<VirtualProperty>; inlined: Array<VirtualProperty>; } export interface SchemaDetails extends ImplementationDetails { /** namespace of the implementation of this item */ namespace?: string; enum?: EnumDetails; purpose?: Purpose; virtualProperties?: VirtualProperties; /** if this is a child of a polymorphic class, this will have the value of the descriminator. */ discriminatorValue?: string; suppressFormat?: boolean; } export declare class Schema extends Extensions implements Schema { details: LanguageDetails<SchemaDetails>; required: string[]; enum: any[]; allOf: Schema[]; oneOf: Schema[]; anyOf: Schema[]; properties: Dictionary<Property>; extensions: Dictionary<any>; constructor(name: string, initializer?: DeepPartial<Schema>); } export declare function getPolymorphicBases(schema: Schema): Array<Schema>; export declare function getAllProperties(schema: Schema): Array<Property>; export declare function getAllPublicVirtualProperties(virtualProperties?: VirtualProperties): Array<VirtualProperty>; export declare function getAllVirtualProperties(virtualProperties?: VirtualProperties): Array<VirtualProperty>; export declare function getVirtualPropertyFromPropertyName(virtualProperties: VirtualProperties | undefined, propertyName: string): VirtualProperty | undefined; export interface Property extends Extensions { details: LanguageDetails<PropertyDetails>; /** description can be on the property reference, so that properties can have a description different from the type description. */ description?: string; schema: Schema; } export declare class Property extends Extensions implements Property { serializedName: string; details: LanguageDetails<PropertyDetails>; extensions: Dictionary<any>; constructor(name: string, initializer?: DeepPartial<Property>); } export declare class Discriminator extends Extensions implements Discriminator { propertyName: string; extensions: Dictionary<any>; mapping: Dictionary<string>; constructor(propertyName: string, initializer?: DeepPartial<Discriminator>); } export interface Discriminator extends Extensions { propertyName: string; mapping: Dictionary<string>; } export declare enum JsonType { Array = "array", Boolean = "boolean", Integer = "integer", Number = "number", Object = "object", String = "string" } export declare function isJsonType(type: JsonType, schema?: Schema): schema is Schema; export declare function isSchemaObject(schema?: Schema): schema is Schema; export declare class XML extends Extensions implements XML { extensions: Dictionary<any>; attribute: boolean; wrapped: boolean; constructor(initializer?: DeepPartial<XML>); } export interface XML extends Extensions { name?: string; namespace?: string; prefix?: string; attribute: boolean; wrapped: boolean; } export interface Schema extends Extensions { details: LanguageDetails<SchemaDetails>; type?: JsonType; title?: string; description?: string; format?: string; nullable: boolean; readOnly: boolean; writeOnly: boolean; deprecated: boolean; required: Array<string>; multipleOf?: number; maximum?: number; exclusiveMaximum?: boolean; minimum?: number; exclusiveMinimum?: boolean; maxLength?: number; minLength?: number; pattern?: string; maxItems?: number; minItems?: number; uniqueItems?: boolean; maxProperties?: number; minProperties?: number; example?: any; default?: any; discriminator?: Discriminator; externalDocs?: ExternalDocumentation; xml?: XML; enum: Array<any>; not?: Schema; allOf: Array<Schema>; oneOf: Array<Schema>; anyOf: Array<Schema>; items?: Schema; properties: Dictionary<Property>; additionalProperties?: boolean | Schema; } export {}; //# sourceMappingURL=schema.d.ts.map