Skip to content

fix "Unexpected fields" in parameter examples#19

Merged
kevindew merged 1 commit intokevindew:mainfrom
klausbadelt:fix-parameters-examples
Feb 9, 2021
Merged

fix "Unexpected fields" in parameter examples#19
kevindew merged 1 commit intokevindew:mainfrom
klausbadelt:fix-parameters-examples

Conversation

@klausbadelt
Copy link
Copy Markdown
Contributor

@klausbadelt klausbadelt commented Feb 6, 2021

On path parameters with examples the document doesn't validate with ["Unexpected fields: value"]. This is due to probably a typo in Openapi3Parser::NodeFactory::ParameterLike#examples_factory, using NodeFactory::Schema instead of NodeFactory::Example. This PR fixes that.

Example from an OpenApi3 spec:

# openapi.yml
# ...
  '/titles/{title_id}/videos':
    parameters:
      - name: title_id
        in: path
        description: Title ID
        required: true
        schema:
          type: integer
        examples:
          post/201:
            value: 12345

This PR fixes Openapi3Parser.load_file('openapi.yaml').errors resulting in ["Unexpected fields: value"].

@Haelle
Copy link
Copy Markdown

Haelle commented Feb 9, 2021

Same here, thanks for the quick fix, you spotted it faster than me !

@kevindew
Copy link
Copy Markdown
Owner

kevindew commented Feb 9, 2021

Oh great - thanks for catching this. I'll get a new release made for it shortly.

@kevindew kevindew merged commit 8e20a9a into kevindew:main Feb 9, 2021
@kevindew
Copy link
Copy Markdown
Owner

kevindew commented Feb 9, 2021

I've released this as part of version 0.9.0 - thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants