swagger-api / swagger-parser

Swagger Spec to Java POJOs
http://swagger.io
Apache License 2.0
778 stars 525 forks source link

Error processing pattern properties #1916

Closed joca-bt closed 1 year ago

joca-bt commented 1 year ago

patternProperties (https://json-schema.org/understanding-json-schema/reference/object.html#pattern-properties) is listed as supported here but when I try to parse an OAS with it I get an error:

[attribute  is not of type `object`]

Java

Path file = Path.of("openapi.yaml");
OpenAPIParser parser = new OpenAPIParser();
SwaggerParseResult result = parser.readContents(file.toString(), Collections.emptyList(), new ParseOptions());
System.out.println(result.getMessages());

OAS

openapi: 3.1.0
info:
  title: Test API
  version: '1.0'
paths:
  /test:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                static:
                  type: string
              patternProperties:
                dynamic:
                  type: string
      responses:
        '200':
          description: Success!
          content:
            application/json:
              schema:
                type: string

See test.zip for the full example.

joca-bt commented 1 year ago

Typo in the code.