-
Notifications
You must be signed in to change notification settings - Fork 97
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
OAS Generation for APIV2 #589
Conversation
Readme hotfix
Readme working.
Readmedocs changes.
Adding to todo: |
@augustjohnson I just pushed an update that eliminates most warnings and all errors. It adds annotations to clarify some types. I left todo's for any type that tripped up my IDE. There are many fields VS code interpreted as I don't know which of these can be improved via code, and which need to be overridden via annotations, but I need to at the very least test each one to make sure my typing is correct. I'll work on the final warnings and todo's tonight, then QA tomorrow. |
When I run this, I get...
The error kind of looks like a warning that there are |
I also get a warning for this line: https://github.com/open5e/open5e-api/blob/staging/api_v2/serializers/spell.py#L23. Every other field I've worked with had a similarly named function or model attribute. This seems to be the only use of |
It doesn't like the way damage die types are created. Because multiple identical enums are created, it gets confused in naming them. This warning is more about highlighting a "possible" bug, not an issue in the output schema, so it's likely safe to ignore. |
Ok, I just squashed the final warning by adding a manual postprocessing step to fix the search object. @augustjohnson let me know if you want me to try to tackle the decimal min/max issue, or remove slot_expended. With those two wrapped up I would be comfortable with marking this ready for review. |
Doing a bit of research into the decimal issue, I believe it's a DRF serializer throwing the error, and it's not clear which. The following places are all places where a decimal (or float) field are defined with mins that are integers instead of decimal/floats. Adding a .0 to these would be easy enough. You have my blessing to add those changes in to see if it fixes the error. Regarding the Extra Damage thing: I have no strong attachment to the current method, but it's a fairly established concept. See Deva as an example of a creature who's attack has "extra" damage. |
Also, regarding slot_expended, looks like that's an old unused field. Feel free to remove. |
|
Hey, here's a thought. Can we replace the current HTML UI here: https://api-beta.open5e.com/ with something nice generated by spectacular? I understand that competes with the readme featureset, but it's easier to find at our own url. |
This comes with swagger-ui and redocly built in. I thought open source readme had access to custom domains, but I just verified, it doesn't. I totally understand if that's a blocker. Here are screenshots: RedoclySwagger-UII can't find a good way to customize their style when we use drf-spectacular, but you could always spin up your own redocly, swagger-ui, or other service if you want more control. And for my reference, this is the code we need to add to server/urls.py.
|
Wow, amazing work here, I didn't realize you were manually forcing the properties to be one of the field types. Yikes. Lots of work. I think this will be a fantastic approach moving forward. |
Thanks! Looking at the OAS file, there's a lot to clean up. I'll poke away at a couple more prs to work on that. |
Addresses #586.
Complete
Todo