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

Schema object cannot have additionalProperty LB4 App #36

Closed
marioestradarosa opened this issue Sep 29, 2018 · 6 comments
Closed

Schema object cannot have additionalProperty LB4 App #36

marioestradarosa opened this issue Sep 29, 2018 · 6 comments

Comments

@marioestradarosa
Copy link
Contributor

marioestradarosa commented Sep 29, 2018

Steps to reproduce

  • Create a loopback 4 app
  • Create a datasource to Mysql
  • Create the student model, repository an controller

Make sure it works thru browser. Then follow the oasgraph quick start guide as follows:

  • Clone oasgraph
  • cd to oasgraph
  • run npm link
  • copy the openapi.json file from loopback 4 app running to my current oasgrahp directory (see attached, I placed .txt at the end to allow github attachment)
    using wget http://localhost:3000/openapi.json
  • run oasgraph openapi.json

The following error was received:

{ AssertionError: Schema object cannot have additionalProperty: patternProperties
    at Assertion.fail (/Users/marioestradarosa/test/oasgraph/node_modules/should/as-function.js:275:17)
    at Assertion.value (/Users/marioestradarosa/test/oasgraph/node_modules/should/as-function.js:356:19)
    at checkSubSchema (/Users/marioestradarosa/test/oasgraph/node_modules/oas-validator/index.js:131:16)
    at walkSchema (/Users/marioestradarosa/test/oasgraph/node_modules/oas-validator/node_modules/oas-schema-walker/index.js:53:5)
    at Object.walkSchema (/Users/marioestradarosa/test/oasgraph/node_modules/oas-validator/node_modules/oas-schema-walker/index.js:82:13)
    at checkSchema (/Users/marioestradarosa/test/oasgraph/node_modules/oas-validator/index.js:332:8)
    at checkContent (/Users/marioestradarosa/test/oasgraph/node_modules/oas-validator/index.js:380:13)
    at checkResponse (/Users/marioestradarosa/test/oasgraph/node_modules/oas-validator/index.js:569:9)
    at checkPathItem (/Users/marioestradarosa/test/oasgraph/node_modules/oas-validator/index.js:782:21)
    at Object.validateSync (/Users/marioestradarosa/test/oasgraph/node_modules/oas-validator/index.js:1160:13)
  operator: 'to be above -1',
  message: 'Schema object cannot have additionalProperty: patternProperties',
  actual: -1,
  stackStartFunction: [Function: assert],
  negate: false,
  assertion: 
   Assertion {
     obj: -1,
     anyOne: false,
     negate: false,
     params: 
      { operator: 'to be above -1',
        message: 'Schema object cannot have additionalProperty: patternProperties',
        actual: -1,
        stackStartFunction: [Function: assert],
        negate: false,
        assertion: [Circular] },
     onlyThis: undefined,
     light: false } }

Attached openapi.json file.
openapi.json.txt

@raymondfeng
Copy link

It’s related to loopbackio/loopback-next#1755. I did not realize that OAS does not allow patternProperties. We need to use a different way to describe headers.

@marioestradarosa
Copy link
Contributor Author

Thanks @raymondfeng , I just started playing around with this library.

@marioestradarosa
Copy link
Contributor Author

We need to use a different way to describe headers.

Are these headers only for ping controller?, I just removed the ping controller spec from openapi.json file and it seems to be running now, albeit still with some complains like (Delete operation having InvalidSchemaType).

@raymondfeng
Copy link

Just for ping controller

@raymondfeng
Copy link

Based on https://swagger.io/docs/specification/data-models/data-types/#object, we can probably use free form object.

@raymondfeng
Copy link

Mario, feel free to submit a patch. Thanks!

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

2 participants