Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pattern is not parsed (OAS2, OAS3) #709

Closed
jmini opened this issue May 16, 2018 · 1 comment
Closed

pattern is not parsed (OAS2, OAS3) #709

jmini opened this issue May 16, 2018 · 1 comment

Comments

@jmini
Copy link
Contributor

jmini commented May 16, 2018

Consider this OAS3 spec (testPattern.yaml):

openapi: 3.0.1
info:
  title: OpenAPI Test
  description: Simple test
  license:
    name: Apache-2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.0
servers:
- url: http://localhost:9999/v2
paths:
  /ping:
    post:
      tags:
      - someTag
      summary: test
      description: test it
      operationId: pingOp
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SomeObj'
        required: true
      responses:
        200:
          description: OK
          content: {}
components:
  schemas:
    SomeObj:
      type: string
      pattern: ^[A-Z]+$

This test fails:

    @Test
    public void testPattern() {
        final OpenAPI openAPI = new OpenAPIParser().readLocation(“../testPattern.yaml", null, new ParseOptions()).getOpenAPI();
        
        Schema s = openAPI.getComponents().getSchemas().get("SomeObj");
        Assert.assertEquals(s.getPattern(),"^[A-Z]+$"); //ERROR: got null
    }
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants