Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Error on Valid Schema #221

Closed
ghost opened this issue Dec 27, 2022 · 2 comments
Closed

Error on Valid Schema #221

ghost opened this issue Dec 27, 2022 · 2 comments

Comments

@ghost
Copy link

ghost commented Dec 27, 2022

I have simple Open API specification which is based on version 3.1.0

On running analyze, I get two errors at the title line:

  1. OpenAPI specification is invalid: /properties/info/$ref doesn't validate with '/definitions/Info'
  2. OpenAPI specification is invalid: /properties/openapi/pattern does not match pattern '^3\.0\.\d(-.+)?$'

In both cases, "How to fix violation" shows "The schema isn't valid OpenAPI 3. Check the errors for more details".

Not sure whats wrong with the YAML manifest:

openapi: 3.1.0
info:
  title: Backend of microblogging application
  description: |-
    Mockroblog is a backend application based on course CPSC-449 Web Back-end Engineering, for the batch of Fall 2021.
    
    Links:
    - [Application homepage](https://blogger.st)
    - [Project repository](https://github.com/saurami/mockroblog)
  contact:
    name: Saurabh Mishra
    url: https://saurabh.cc
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  version: 1.0

servers:
  - url: https://blogger.st/api/v1
    description: Production APIs

tags:
  - name: hello
    description: Hello world

paths:
  /hello:
    get:
      tags:
        - hello
      summary: Get "Hello, world!" response
      description: Get "Hello, world!" as a utf-8 encoded text response
      operationId: helloHandler
      responses:
        '200':
          description: successful operation
          content:
            text/plain:
              schema:
                type: string
              example: 'Hello!'
@daveshanley
Copy link
Owner

Interestingly, the schema error messages are not very helpful; the underlying schema library is spewing some really unhelpful messages. It's the same issues reported in #210.

I am back online in a few days. I will investigate more then.

@daveshanley
Copy link
Owner

daveshanley commented Dec 30, 2022

There is improved schema issue reporting in v0.0.48. It's much more helpful.

When I run this spec through it, it tells me that the $.info.version is a number (1.0). It's supposed to be a string "1.0"

So, this isn't a bug, it's actually invalid. but thank you for your report. The schema error messages are now better because of your nudge.

@daveshanley daveshanley closed this as not planned Won't fix, can't repro, duplicate, stale Dec 30, 2022
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

No branches or pull requests

1 participant