Current section

Files

Jump to
oaspec src oaspec@capability.erl
Raw

src/oaspec@capability.erl

-module(oaspec@capability).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/oaspec/capability.gleam").
-export([registry/0, by_level/1]).
-export_type([support_level/0, capability/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-type support_level() :: supported |
normalizable |
parsed_not_used |
unsupported |
not_handled.
-type capability() :: {capability,
binary(),
binary(),
support_level(),
binary()}.
-file("src/oaspec/capability.gleam", 23).
?DOC(" The single source of truth for feature support.\n").
-spec registry() -> list(capability()).
registry() ->
[{capability,
<<"object"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"Object schemas with properties"/utf8>>},
{capability,
<<"string"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"String schemas with enum, format, pattern"/utf8>>},
{capability,
<<"integer"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"Integer schemas"/utf8>>},
{capability,
<<"number"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"Number schemas"/utf8>>},
{capability,
<<"boolean"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"Boolean schemas"/utf8>>},
{capability,
<<"array"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"Array schemas with items"/utf8>>},
{capability,
<<"allOf"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"Schema composition"/utf8>>},
{capability,
<<"oneOf"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"Schema composition with discriminator"/utf8>>},
{capability,
<<"anyOf"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"Schema composition with discriminator"/utf8>>},
{capability,
<<"nullable"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"Nullable fields"/utf8>>},
{capability,
<<"additionalProperties"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"Typed, untyped, forbidden; absent key omits the additional_properties field from generated records"/utf8>>},
{capability,
<<"$ref"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"Local $ref resolution"/utf8>>},
{capability,
<<"enum"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"String enum values"/utf8>>},
{capability,
<<"discriminator"/utf8>>,
<<"schema"/utf8>>,
supported,
<<"With propertyName and mapping"/utf8>>},
{capability,
<<"const"/utf8>>,
<<"schema"/utf8>>,
normalizable,
<<"Normalized to single-value enum"/utf8>>},
{capability,
<<"type: [T, null]"/utf8>>,
<<"schema"/utf8>>,
normalizable,
<<"Normalized to nullable"/utf8>>},
{capability,
<<"type: [T1, T2]"/utf8>>,
<<"schema"/utf8>>,
normalizable,
<<"Normalized to oneOf"/utf8>>},
{capability,
<<"$defs"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Move definitions to components/schemas"/utf8>>},
{capability,
<<"prefixItems"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Tuple types not supported"/utf8>>},
{capability,
<<"if"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Use oneOf/anyOf instead"/utf8>>},
{capability,
<<"then"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Use oneOf/anyOf instead"/utf8>>},
{capability,
<<"else"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Use oneOf/anyOf instead"/utf8>>},
{capability,
<<"dependentSchemas"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Not supported"/utf8>>},
{capability,
<<"not"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Negation not supported"/utf8>>},
{capability,
<<"unevaluatedProperties"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Not supported"/utf8>>},
{capability,
<<"unevaluatedItems"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Not supported"/utf8>>},
{capability,
<<"contentEncoding"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Not supported"/utf8>>},
{capability,
<<"contentMediaType"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Not supported"/utf8>>},
{capability,
<<"contentSchema"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Not supported"/utf8>>},
{capability,
<<"$id"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"OpenAPI 3.1 JSON Schema `$id`-backed URL refs are not resolved; use local `#/components/schemas/...` refs instead"/utf8>>},
{capability,
<<"const (non-string)"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Only string `const` is lowered to a single-value enum; non-string `const` (bool, int, number, object, array, null) cannot be represented in generated code"/utf8>>},
{capability,
<<"type: [T1, T2] with type-specific constraints"/utf8>>,
<<"schema"/utf8>>,
unsupported,
<<"Multi-type schemas are rewritten to `oneOf`, which would silently drop type-specific constraints (pattern, minLength, minimum, etc.). Split the schema into separate variants or drop the constraints"/utf8>>},
{capability,
<<"apiKey"/utf8>>,
<<"security"/utf8>>,
supported,
<<"Header, query, cookie"/utf8>>},
{capability,
<<"http"/utf8>>,
<<"security"/utf8>>,
supported,
<<"Bearer, basic, and digest auth"/utf8>>},
{capability,
<<"oauth2"/utf8>>,
<<"security"/utf8>>,
supported,
<<"Bearer token attachment only; token acquisition and refresh are not generated"/utf8>>},
{capability,
<<"openIdConnect"/utf8>>,
<<"security"/utf8>>,
supported,
<<"Bearer token attachment only; discovery and token acquisition are not generated"/utf8>>},
{capability,
<<"mutualTLS"/utf8>>,
<<"security"/utf8>>,
unsupported,
<<"Not supported"/utf8>>},
{capability,
<<"path parameters"/utf8>>,
<<"parameter"/utf8>>,
supported,
<<"With schema validation"/utf8>>},
{capability,
<<"query parameters"/utf8>>,
<<"parameter"/utf8>>,
supported,
<<"Including deepObject"/utf8>>},
{capability,
<<"header parameters"/utf8>>,
<<"parameter"/utf8>>,
supported,
<<"String, int, float, bool"/utf8>>},
{capability,
<<"cookie parameters"/utf8>>,
<<"parameter"/utf8>>,
supported,
<<"With percent-decoding"/utf8>>},
{capability,
<<"allowReserved"/utf8>>,
<<"parameter"/utf8>>,
supported,
<<"Skips percent-encoding"/utf8>>},
{capability,
<<"application/json"/utf8>>,
<<"request"/utf8>>,
supported,
<<"JSON request bodies"/utf8>>},
{capability,
<<"application/x-www-form-urlencoded"/utf8>>,
<<"request"/utf8>>,
supported,
<<"Form bodies"/utf8>>},
{capability,
<<"multipart/form-data"/utf8>>,
<<"request"/utf8>>,
supported,
<<"Multipart upload"/utf8>>},
{capability,
<<"+json/+xml suffix"/utf8>>,
<<"content-type"/utf8>>,
supported,
<<"Structured syntax suffix media types (e.g. application/problem+json)"/utf8>>},
{capability,
<<"application/json"/utf8>>,
<<"response"/utf8>>,
supported,
<<"JSON responses"/utf8>>},
{capability,
<<"text/plain"/utf8>>,
<<"response"/utf8>>,
supported,
<<"Text passthrough"/utf8>>},
{capability,
<<"application/octet-stream"/utf8>>,
<<"response"/utf8>>,
supported,
<<"Binary passthrough"/utf8>>},
{capability,
<<"application/xml"/utf8>>,
<<"response"/utf8>>,
supported,
<<"XML passthrough; no structural decoding yet"/utf8>>},
{capability,
<<"text/xml"/utf8>>,
<<"response"/utf8>>,
supported,
<<"XML passthrough; no structural decoding yet"/utf8>>},
{capability,
<<"server: complex path parameters"/utf8>>,
<<"server-validation"/utf8>>,
unsupported,
<<"Path parameters must be scalar (string, integer, number, boolean)"/utf8>>},
{capability,
<<"server: non-primitive query array items"/utf8>>,
<<"server-validation"/utf8>>,
unsupported,
<<"Query array parameters require inline primitive items"/utf8>>},
{capability,
<<"server: non-primitive header array items"/utf8>>,
<<"server-validation"/utf8>>,
unsupported,
<<"Header array parameters require inline primitive items"/utf8>>},
{capability,
<<"server: complex deepObject properties"/utf8>>,
<<"server-validation"/utf8>>,
unsupported,
<<"deepObject properties must be primitive scalars or primitive array leaves"/utf8>>},
{capability,
<<"server: mixed form-urlencoded request"/utf8>>,
<<"server-validation"/utf8>>,
unsupported,
<<"application/x-www-form-urlencoded must be the sole request content type"/utf8>>},
{capability,
<<"server: complex form-urlencoded fields"/utf8>>,
<<"server-validation"/utf8>>,
unsupported,
<<"Form fields must be primitive scalars, primitive arrays, or shallow nested objects (max 5 levels)"/utf8>>},
{capability,
<<"server: mixed multipart request"/utf8>>,
<<"server-validation"/utf8>>,
unsupported,
<<"multipart/form-data must be the sole request content type"/utf8>>},
{capability,
<<"server: complex multipart fields"/utf8>>,
<<"server-validation"/utf8>>,
unsupported,
<<"Multipart fields must be primitive scalars (or arrays of them)"/utf8>>},
{capability,
<<"server: unsupported request content type"/utf8>>,
<<"server-validation"/utf8>>,
unsupported,
<<"Server router only supports application/json, application/x-www-form-urlencoded, and multipart/form-data"/utf8>>},
{capability,
<<"webhooks"/utf8>>,
<<"scope"/utf8>>,
parsed_not_used,
<<"Parsed but no codegen"/utf8>>},
{capability,
<<"externalDocs"/utf8>>,
<<"scope"/utf8>>,
parsed_not_used,
<<"Parsed but no codegen"/utf8>>},
{capability,
<<"tags"/utf8>>,
<<"scope"/utf8>>,
parsed_not_used,
<<"Parsed but no codegen"/utf8>>},
{capability,
<<"examples"/utf8>>,
<<"scope"/utf8>>,
parsed_not_used,
<<"Parsed but no codegen"/utf8>>},
{capability,
<<"links"/utf8>>,
<<"scope"/utf8>>,
parsed_not_used,
<<"Parsed but no codegen"/utf8>>},
{capability,
<<"callbacks"/utf8>>,
<<"scope"/utf8>>,
parsed_not_used,
<<"Operation-level and components.callbacks are parsed and preserved (including `$ref` to `#/components/callbacks/...`) but no code is generated for callback endpoints"/utf8>>},
{capability,
<<"xml"/utf8>>,
<<"scope"/utf8>>,
not_handled,
<<"XML annotations ignored"/utf8>>},
{capability,
<<"response headers"/utf8>>,
<<"scope"/utf8>>,
supported,
<<"Response header types generated"/utf8>>},
{capability,
<<"encoding"/utf8>>,
<<"scope"/utf8>>,
parsed_not_used,
<<"Parsed but no codegen"/utf8>>}].
-file("src/oaspec/capability.gleam", 288).
?DOC(" Get capabilities by level.\n").
-spec by_level(support_level()) -> list(capability()).
by_level(Level) ->
gleam@list:filter(registry(), fun(C) -> erlang:element(4, C) =:= Level end).