Skip to main content

Module openapi3

Module openapi3 

Source
Expand description

@typespec/openapi3 - OpenAPI 3.x Emitter Decorators and Types

Ported from TypeSpec packages/openapi3

Provides decorators and types for OpenAPI 3.x emitter:

  • @useRef - Override $ref for a model or property
  • @oneOf - Emit union as oneOf instead of anyOf

Also defines emitter options and OpenAPI version types.

Structs§

OpenApi3EmitterOptions
OpenAPI 3 emitter options. Ported from TS OpenAPI3EmitterOptions interface.

Enums§

ExperimentalParameterExamplesStrategy
Strategy for emitting parameter examples. Ported from TS ExperimentalParameterExamplesStrategy type.
IncludeXTypeSpecName
When to include x-typespec-name extension
NewLine
Newline character setting for emitter output
OneOfStrategy
Strategy for handling @oneOf in OpenAPI
OpenApiVersion
OpenAPI specification version
OperationIdStrategy
Strategy for generating operation IDs when @operationId is not used. Ported from TS OperationIdStrategy type.
SafeIntStrategy
Strategy for handling safeint type

Constants§

DIAG_DEFAULT_NOT_SUPPORTED
Diagnostic: Default value not supported in OpenAPI 3.0
DIAG_DUPLICATE_HEADER
Diagnostic: Duplicate header across content types
DIAG_EMPTY_ENUM
Diagnostic: Empty enum not supported
DIAG_EMPTY_UNION
Diagnostic: Empty union not supported
DIAG_ENUM_UNIQUE_TYPE
Diagnostic: Enum options must be same literal type
DIAG_INCONSISTENT_SHARED_ROUTE
Diagnostic: Inconsistent shared route request visibility
DIAG_INLINE_CYCLE
Diagnostic: Inline cycle detected
DIAG_INVALID_COMPONENT_KEY
Diagnostic: Invalid component fixed field key
DIAG_INVALID_FORMAT
Diagnostic: Invalid format for collection format
DIAG_INVALID_MODEL_PROPERTY
Diagnostic: Invalid model property type
DIAG_INVALID_SCHEMA
Diagnostic: Cannot get schema for type
DIAG_INVALID_SERVER_VARIABLE
Diagnostic: Invalid server variable type
DIAG_INVALID_STYLE
Diagnostic: Invalid style for parameter
DIAG_ONEOF_UNION
Diagnostic: @oneOf can only be applied to a union or model property with union type
DIAG_PATH_QUERY
Diagnostic: Path contains query string
DIAG_PATH_RESERVED_EXPANSION
Diagnostic: Reserved expansion in path parameter
DIAG_RESOURCE_NAMESPACE
Diagnostic: Resource must be on namespace
DIAG_STATUS_CODE_IN_DEFAULT_RESPONSE
Diagnostic: Status code in default response
DIAG_STREAMS_NOT_SUPPORTED
Diagnostic: Streams not supported in OpenAPI 3.0
DIAG_UNION_NULL
Diagnostic: Union containing only null types
DIAG_UNSUPPORTED_AUTH
Diagnostic: Unsupported auth type
DIAG_UNSUPPORTED_STATUS_CODE_RANGE
Diagnostic: Unsupported status code range
DIAG_XML_ATTRIBUTE_INVALID
Diagnostic: XML attribute invalid property type
DIAG_XML_UNWRAPPED_INVALID
Diagnostic: XML unwrapped invalid property type
OPENAPI3_DECORATORS_TSP
The TypeSpec source for the OpenAPI3 library decorators
OPENAPI3_NAMESPACE
Namespace for OpenAPI3 types
STATE_OPENAPI_ONE_OF
State key for @oneOf decorator (openapi3-specific)
STATE_USE_REF
State key for @useRef decorator

Functions§

apply_openapi_one_of
Apply decorator (flag - no value).
apply_use_ref
Apply decorator (string value).
create_openapi3_library
Create the @typespec/openapi3 library diagnostic map. Ported from TS $lib diagnostics in lib.ts.
get_use_ref
Get decorator value.
is_openapi_one_of
Check if decorator is applied.