-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
HTML rendering broken / unusable when allOf and oneOf even if spec is considered 0 warning #2562
Comments
notice that according to https://github.com/hyperjump-io/json-schema.hyperjump.io and |
If you remove the oneOf inside Dog, it starts working. On one hand, it's redundant, and removing it even makes the documentation a bit more readable. On the other hand, the schema is valid, so I'd expect Redoc to render it correctly. @Redocly/keyboard-warriors, could you check if it's a bug on Redoc's end? |
@tatomyr you are right , the sample has been over simplified , as the real use case was to have |
It is Redoc issue. We'll look into it later. |
I think I've hit this issue too.
and a schema file (both.json) that references them both
Using the CLI to generate the docs, using both.json as an endpoints schema, the documentation only shows the second choice fields. so switching the order causes the other choice to be visible.
However... If I inline the refs, I can get it to show both fields.
If one of the refs is not an 'oneOf' that also seem to work fine for me.
|
If I understand your issue, this should be a valid reproduction of it... openapi: 3.0.3
info:
title: '2562'
version: '0.0.1'
servers:
- url: https://redocly.com
paths:
'/thing':
get:
summary: test allOf with nested oneOf by $ref
responses:
'200':
description: OK
content:
'application/json':
schema:
allOf:
- $ref: '#/components/schemas/one-of-1'
- $ref: '#/components/schemas/one-of-2'
examples:
one-of-1:
value:
that: 'test'
one-of-2:
value:
thing: 'test'
all-of:
value:
thing: 'test'
that: "doesn't work"
components:
schemas:
one-of-1:
title: one-of-1
type: object
oneOf:
- properties:
this:
type: string
- properties:
that:
type: string
one-of-2:
title: one-of-2
type: object
oneOf:
- properties:
thing:
type: string
- properties:
another_thing:
type: string # redocly.yaml
extends:
- recommended
rules:
no-invalid-media-type-examples: warn In this case, the schema defined is illogical because you can never have a valid instance against this schema. The take these examples to explain further: individual property from
|
Describe the bug
given a specification with no error , no warning using redocly lint , the documentation generated via redocly build-docs "crashes" at rendering , and make it unusable
To Reproduce
given the Open API description attached
run
redocly build-docs .\component-descriptor.yml
Open the HTML File produce ,
select for kind the value CAT , the HTML rendering is ok
select for kind the value DOG ; the HTML rendering is broken and does not allow anymore to choose a value
Expected behavior
Either the API specification is considered as invalid are not renderable , and the build doc should shoot an error ,can be at the build doc or at the linter level
Either it is considered as correct and the rendering should be OK
Logs
NA
OpenAPI description
cf attached file (notice that yml or json does not matter)
Redocly Version(s)
redocly --version
1.16.0
Node.js
Version(s)node --version
v18.16.0
Additional context
component-descriptor.json
The text was updated successfully, but these errors were encountered: