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

OpenAPI definition failed validation #5

Closed
muhme opened this issue Oct 30, 2023 · 1 comment
Closed

OpenAPI definition failed validation #5

muhme opened this issue Oct 30, 2023 · 1 comment

Comments

@muhme
Copy link
Owner

muhme commented Oct 30, 2023

LoopBack4 included validator (button at the bottom right)

https://validator.swagger.io/validator/debug?url=https://api.zitat-service.de/v1/explorer/openapi.json

failed with following errors:

{
   "messages":[
      "attribute paths.'/v1/author'(get).parameters.[language].default is unexpected",
      "attribute paths.'/v1/author'(get).parameters.[authorId].default is unexpected",
      "attribute paths.'/v1/authors'(get).parameters.[language].default is unexpected",
      "attribute paths.'/v1/authors'(get).parameters.[page].default is unexpected",
      "attribute paths.'/v1/authors'(get).parameters.[size].default is unexpected",
      "attribute paths.'/v1/categories'(get).parameters.[language].default is unexpected",
      "attribute paths.'/v1/categories'(get).parameters.[page].default is unexpected",
      "attribute paths.'/v1/categories'(get).parameters.[size].default is unexpected",
      "attribute paths.'/v1/quote_html'(get).parameters.[contentOnly].default is unexpected",
      "attribute paths.'/v1/users'(get).parameters.[page].default is unexpected",
      "attribute paths.'/v1/users'(get).parameters.[size].default is unexpected",
      "attribute paths.'/v1/authors'(get).operationId is repeated"
   ],
   "schemaValidationMessages":[
      {
         "level":"error",
         "domain":"validation",
         "keyword":"oneOf",
         "message":"instance failed to match exactly one schema (matched 0 out of 2)",
         "schema":{
            "loadingURI":"#",
            "pointer":"/definitions/Operation/properties/parameters/items"
         },
         "instance":{
            "pointer":"/paths/~1v1~1author/get/parameters/0"
         }
      },
      {
         "level":"error",
         "domain":"validation",
         "keyword":"oneOf",
         "message":"instance failed to match exactly one schema (matched 0 out of 2)",
         "schema":{
            "loadingURI":"#",
            "pointer":"/definitions/Operation/properties/parameters/items"
         },
         "instance":{
            "pointer":"/paths/~1v1~1author/get/parameters/1"
         }
      }
   ]
}
muhme added a commit that referenced this issue Oct 31, 2023
for errors from validator like:
  "attribute paths.'/v1/author'(get).parameters.[language].default is unexpected"
To solve this error the default value for the language parameter is defined
within the schema object inside the decorator.
muhme added a commit that referenced this issue Oct 31, 2023
"attribute paths.'/v1/authors'(get).operationId is repeated"
fixed the copy&paste error to have two different operation ids
@muhme
Copy link
Owner Author

muhme commented Oct 31, 2023

validator is green now 😄
green

@muhme muhme closed this as completed Oct 31, 2023
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