-
Notifications
You must be signed in to change notification settings - Fork 23
Support for allOf and a host of small improvements and bug fixes #436
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woah this is great!
@@ -393,10 +393,12 @@ Doc.propTypes = { | |||
language: PropTypes.string.isRequired, | |||
lazy: PropTypes.bool, | |||
Logs: PropTypes.func, | |||
maskErrorMessages: PropTypes.bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this property get sent down from ReadMe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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#/definitions
rjsf-team/react-jsonschema-form#954 back into our fork until a future release of RJSF will support it directly.format: blob
andformat: html
on string params to show a textarea.allOf
in the form.oneOf
andanyOf
UI quirks. See Support for allOf and a host of small improvements and bug fixes #436 (comment) for details.allOf
,oneOf
, andanyOf
in response schemas.oneOf
andanyOf
cases, 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
$ref
pointers that are escaped.Pet~1Error
, the actual schema we should look for isPet/Error
but we'd look for thePet~1Error
instead. We now properly handle these escaped cases.oneOf
schemas nested inside of an object that were populated via a$ref
would fail. Fixes https://github.com/readmeio/api-explorer/issues/495.👨🎨 Comparisons
🚧 Known Quirks
oneOf
state preserves any data in the code sample/request that was set on the other object.Loading aoneOf
that contains anallOf
causes 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.oneOf
elements, but see Support for allOf and a host of small improvements and bug fixes #436 (comment) for details.