Class Oas31KeywordScanner


  • public final class Oas31KeywordScanner
    extends Object
    OAS 3.1 dialect resolution and exhaustive schema-keyword scanning.

    swagger-parser and swagger-models do not retain every OAS 3.1 schema surface. This class resolves the effective document dialect and records the schema keywords visible after parsing. Keywords are classified as emitted, annotation-only, or explicitly rejected; unsupported required vocabularies and unnormalized dynamic references fail closed.

    • Method Detail

      • resolveEffectiveDialect

        public static CppBoostBeastModelCodegen.OasDialect resolveEffectiveDialect​(String jsonSchemaDialect,
                                                                                   String rootSchema)
        Resolve the effective schema dialect from the top-level jsonSchemaDialect and/or the root $schema. Per OAS 3.1 the root $schema (when present at a document/schema-resource root) takes precedence over jsonSchemaDialect for that resource.
      • resolveDocumentDialect

        public static CppBoostBeastModelCodegen.OasDialect resolveDocumentDialect​(io.swagger.v3.oas.models.OpenAPI api)
        Resolve the effective dialect of an OpenAPI document from its knobs.
      • validateNormativeOas3Structure

        public static List<String> validateNormativeOas3Structure​(io.swagger.v3.oas.models.OpenAPI api)
        OAS 3 structural normative checks. Returns a list of human-readable diagnostics; an empty list means the structure is normative. The caller decides whether to fail generation (strict mode).
      • validateDialectPolicy

        public static List<String> validateDialectPolicy​(io.swagger.v3.oas.models.OpenAPI api)
        Dialect/metaschema policy gate: a dialect identifier that is not recognized by this program must be refused (unknown required vocabulary). The OAS 3.1 default applies when an OAS 3.1 document declares no jsonSchemaDialect.

        Required vocabularies and resource-level dialect selectors are checked on every schema surface visible through swagger-models.

      • scanSchemaKeywordOccurrences

        public static Oas31KeywordScanner.KeywordOccurrenceLedger scanSchemaKeywordOccurrences​(io.swagger.v3.oas.models.OpenAPI api)
        Exhaustive schema-valued-position scanner. Walks component schemas plus every inline schema reachable from paths, webhooks, callbacks, reusable parameters, headers, request bodies, responses, and path items. Each schema is then traversed through every schema-valued JSON Schema 2020-12 child keyword. Reference targets ($ref) are not followed here; reusable targets are scanned at their component location.
      • failClosedKeywords

        public static Set<String> failClosedKeywords​(io.swagger.v3.oas.models.OpenAPI api)
        Set of fail-closed required-vocabulary keywords actually encountered for this document (the keywords the generator refuses rather than silently accepting).