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

Cannot convert OpenAPI type to schema #103

Closed
evilsneer opened this issue Feb 19, 2021 · 3 comments
Closed

Cannot convert OpenAPI type to schema #103

evilsneer opened this issue Feb 19, 2021 · 3 comments

Comments

@evilsneer
Copy link

evilsneer commented Feb 19, 2021

Hi! I try to use with 0.1.15-SNAPSHOT jira swagger

& getting error

#error {
   :message "Cannot convert OpenAPI type to schema", 
   :data {
      :definition 
         {:description "Details of the user who attached the file.", 
         :readOnly true, 
         :allOf [{:$ref "#/components/schemas/User"}]}}}

guess it is because :type is missing? Im assuming "jira" means it is array.

but! version 0.1.12 seems to works fine - I used it with this swagger some time ago; at least, it loads and allows to call methods (some of, not checked it all)

@oliyh
Copy link
Owner

oliyh commented Feb 25, 2021

Hi,

Thanks for reporting this, I suspect it's more likely that Martian is more eagerly consuming more of the schema than it used to, rather than a regression. Either way, I will make a test based on this and ensure it works.

Thanks

@oliyh
Copy link
Owner

oliyh commented Mar 8, 2021

Hi,

This was a difference between the OpenAPI v3 parsing and the Swagger v2 parsing - the latter used to return s/Any for things it didn't understand, whereas the new code throws this error. I've updated it to return s/Any as well so that this schema now parses.

You are correct in that it fails because there was no type, instead the allOf should have this behaviour:

The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes an array of object definitions that are validated independently but together compose a single object.
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#composition-and-inheritance-polymorphism

I have created another issue for supporting that in #107 but I will close this one for now.

@oliyh
Copy link
Owner

oliyh commented Mar 8, 2021

This is available in 0.1.16

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