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
Missing Query Schemas #108
Comments
Hi Simon! Thank you for your persistence in trying to make OASGraph work! Your feedback is so valuable to us as it helps us identify what we need to do to make OASGraph better. I hope you will continue to stick with us as we try to address these issues. The missing operation is very strange. I briefly looked into it with @ErikWittern and I am about to take a deep dive into it right now. I addressed #107 in the latest commit! Everything should be nice and alphabetized as soon as the pull request goes through. |
Cool, thanks guys, the alphabetical order fix is working nicely! |
I think I know what the problem is! In GraphQL, field names must be unique. In the OAS you provided, there are a few operations that will receive the same field name from OASGraph. They are the following:
I think it's bad that we don't throw a warning so I'll try to change that. Aside from that, it's hard to say what's the best way to move forward... We could try to put some automatic mitigation in place... For example, we could append a number at the end of a duplicated field name. However, this can create other types of name collisions. I can go into more detail if you'd like. Another method would be to define a new schema just so you can provide another name but this is a pretty ugly solution... What do you think? |
@Alan-Cha In such cases, if present, how about relying on the |
@ErikWittern It's a possibility but I think it's still vulnerable to name collisions. Another problem is that it makes naming inconsistent. The query field names (as opposed to mutation field names) are based on the return type. The |
Related to IBM#108 Signed-off-by: Alan Cha <Alan.cha1@ibm.com>
Related to IBM#108 Signed-off-by: Alan Cha <Alan.cha1@ibm.com>
Related to IBM#108 Signed-off-by: Alan Cha <Alan.cha1@ibm.com>
Related to #108 Signed-off-by: Alan Cha <Alan.cha1@ibm.com>
@Alan-Cha I'm still a little confused. I'm sure you're right - it's to do with duplicates etc. In the attached swagger I've added some more endpoints and this time Incidentally, for me personally, |
@simax I think that is all still in line with the diagnosis. We specifically tried to use the name of the schema for fields, i.e., if a content:
application/json:
schema:
$ref: '#/components/schemas/Orders' ...OASGraph will try to call the field By the way, we made an explicit decision for using schema names, as we observed that many OAS contain operation ids like One idea @Alan-Cha proposed was to provide an option for users to chose to use |
@simax Yes, the diagnosis is still true. It is weird that OASGraph already has some soft query field name collision mitigation based on the The problem with the current mitigation is that the order in which OASGraph processes these operations is not always clear. After all, it is simply going through the unsorted properties of a JSON object (the OAS) one by one. To demonstrate, let's look at I believe when OASGraph processes the first schema, it processes the When OASGraph processes the second schema, it processes In the first case, an operation is missing but in the second, both operations exist as expected. I think a hard solution to this problem is to create an option that allows you to manually define field names from In regards to automatic mitigation, I think there is still room for improvement. |
Related to IBM#108 Signed-off-by: Alan Cha <Alan.cha1@ibm.com>
Great, thanks for the explanation I'll look out for your next release. |
Related to IBM#108 Signed-off-by: Alan Cha <Alan.cha1@ibm.com>
Related to #108 Signed-off-by: Alan Cha <Alan.cha1@ibm.com>
@simax We just released OASGraph v0.14.0 which can support all operations in both of the OASs you provided using the new |
Awesome, thanks guys. I just tried this out and it's working well. Much appreciated! |
Thanks @Alan-Cha ! We did a manual patch a few months back to make it through a project, and always wanted to report and help add an option like this! Glad this is just resolved and we don't need to use our fork anymore. |
@lhr0909 Thanks for letting us know! Always feel free to report new issues and help contribute to OASGraph. We love hearing from our users, even if it's not always positive news 😆 Glad to hear other people think this option is useful too! |
I recently reported in issue #92 that I now no longer produce an
OAS
inSwagger 2.0
format but now produce one inOpenApi 3.0.1
format. :swagger.txt
Even though I seem to get better results with that, the results are still somewhat disappointing when using
OASGraph
to generate the schema and trying to use the generatedOAS
inGraphiQL
.The following problems still occur:
SearchOrders (and possibly others) is missing from the schema and docs even though it's in the Swagger.json file.
Also, as mentioned in issue #107 how can I get the docs to present the schema in alphabetical order?
The text was updated successfully, but these errors were encountered: