module OutputBuilderOasCommon

Direct including types

Defined in:

output_builder/oas_common.cr

Constant Summary

ANY_OPERATION_METHODS = WILDCARD_HTTP_METHODS.map(&.downcase)
OAS2_OPERATION_METHODS = VALID_OPERATION_METHODS - Set {"trace", "query"}

Swagger 2.0's Path Item Object has no trace field (arrived with OpenAPI 3.0) and no query field (arrived with OpenAPI 3.2, a version Swagger 2.0 will never advance to). Emitting either made the whole document invalid, not just that operation, and an ANY route expands across every verb, so trace alone hit 25 of the fixture tree's OAS2 documents.

PATH_CONVERTER_TYPES = Set {"int", "str", "string", "slug", "uuid", "float", "bool", "path"}

Converter names that can appear in a <…> path placeholder. Same list the optimizer's angle_bracket_param uses, so the two resolve a placeholder the same way.

UNIONED_OPERATION_KEYS = Set {"servers", "x-noir-operations", "x-noir-hosts"}

Operation keys whose value is a list of alternatives rather than a single answer. When two endpoints collapse onto one path+method, keeping the first one's value throws the rest away — servers would name one of two hosts, x-noir-operations one of fifteen GraphQL operations — so these are unioned instead.

VALID_OPERATION_METHODS = Set {"get", "put", "post", "delete", "options", "head", "patch", "trace", "query"}

The operation keys a Path Item Object accepts. query (RFC 10008) arrived with OpenAPI 3.2, so the oas3 builder only emits it as a real operation key — bumping the document's declared openapi version to 3.2.0 when (and only when) it does; every other emitted document stays on 3.0.3. Swagger 2.0 has no later version to adopt query into and can never express it, so OAS2_OPERATION_METHODS below excludes it and a QUERY endpoint keeps degrading to the x-noir-unsupported-methods extension rather than being dropped or downgraded to get.