Support for allOf and a host of small improvements and bug fixes#436
Support for allOf and a host of small improvements and bug fixes#436
Conversation
domharrington
left a comment
There was a problem hiding this comment.
Jon, this is fantastic work. Really thorough and detailed description of the work done and the known limitations and issues with the current approach. I had a few questions inline, but on the whole this looks amazing. It's gunna be a game changer for our customers who require this.
I'd love to see a link on a PR app with the polymorphism fully working, with a side by side link to it failing on production!
| describe('schema format handling', () => { | ||
| describe('string types', () => { | ||
| it('json should render as <textarea>', () => { | ||
| it.each([ |
| language: PropTypes.string.isRequired, | ||
| lazy: PropTypes.bool, | ||
| Logs: PropTypes.func, | ||
| maskErrorMessages: PropTypes.bool, |
There was a problem hiding this comment.
How does this property get sent down from ReadMe?
There was a problem hiding this comment.
Haven't done that part yet, but the idea was to expose the isAdmin boolean from hub2 users to a <script data-json="..." /> tag our API Reference template in the same way we populate the rest of the Explorer.

🌱 Improvements
@readme/react-jsonschema-form, which is running the latest version of the upstream project.Backporting Allow schema $refs to not have to start with#/definitionsrjsf-team/react-jsonschema-form#954 back into our fork until a future release of RJSF will support it directly.format: blobandformat: htmlon string params to show a textarea.allOfin the form.oneOfandanyOfUI quirks. See Support for allOf and a host of small improvements and bug fixes #436 (comment) for details.allOf,oneOf, andanyOfin response schemas.oneOfandanyOfcases, since we can't really flatten down every option defined in those arrays into a single schema that would validate against the document, I'm choosing to just select the first defined object in the set and flatten that out.🐛 Bug fixes
$refpointers that are escaped.Pet~1Error, the actual schema we should look for isPet/Errorbut we'd look for thePet~1Errorinstead. We now properly handle these escaped cases.oneOfschemas nested inside of an object that were populated via a$refwould fail. Fixes https://github.com/readmeio/api-explorer/issues/495.👨🎨 Comparisons
🚧 Known Quirks
oneOfstate preserves any data in the code sample/request that was set on the other object.Loading aoneOfthat contains anallOfcauses the form to appear without CSS, but toggling between the dropdown eventually fixes it. Unfortunately toggling another item in the form will break the CSS again.oneOfelements, but see Support for allOf and a host of small improvements and bug fixes #436 (comment) for details.