-
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
x-examples for request body param does not display #1743
Comments
{
"swagger": "2.0",
"info": {
"description": "test",
"version": "v4",
"title": "test",
"license": {
"name": "test"
}
},
"basePath": "/v4",
"x-stoplight": {
"docs": {
"showModels": false
}
},
"paths": {
"/test": {
"post": {
"operationId": "test",
"summary": "test",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "body",
"name": "test",
"description": "test",
"schema": {
"type": "object",
"properties": {
"key": {
"type": "string"
}
}
},
"x-examples": {
"application/json": {
"key": "customerId"
}
}
}
]
}
}
}
} |
This is expected behaviour. We do not show request body examples in the middle panel. They are shown in the right panel. |
that's indeed my issue, it does not show in the right panel ... the example displayed is {
"key": "string"
} (generated) {
"key": "customerId"
} (custom one from x-examples) |
Ah, I apologize, looks like x-examples support was missed during react rewrite 😳 . We'll fix that. |
you're welcome ! ;) |
https://redoc.ly/docs/api-reference-docs/specification-extensions/x-examples/ It seems the usage is slightly incorrect too. It should be like: "x-examples": {
"application/json": {
"your-example-name": {
"value": {
"key": "customerId"
}
}
}
} |
indeed anyway tried with this: {
"swagger": "2.0",
"info": {
"title": "test",
"version": "v4",
"description": "test",
"license": {
"name": "test"
}
},
"basePath": "/v4",
"paths": {
"/test": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "test",
"description": "test",
"schema": {
"type": "object",
"properties": {
"key": {
"type": "string"
}
}
},
"in": "body",
"x-examples": {
"application/json": {
"a-sample": {
"summary": "Some Example",
"value": {
"key": "customerId"
}
},
"another-sample": {
"summary": "Some Other Example",
"value": {
"key": "anotherKey"
}
}
}
}
}
],
"responses": {
"201": {
"description": "Created"
}
},
"operationId": "test",
"summary": "test"
}
}
}
} and result is the same : none of my two samples are displayed and no dropdown to choose between two samples |
Hi guys ! Is there a chance that this regression bug is being addressed soon ? thx ! |
thx for the fix thx |
ok your sample matches mine |
perfect, re run yarn install on my docusaurus project and it cleaned unused but still present redoc 2.0.0-rc57 |
If I use the x-examples vendor extension with ReDoc 2.0.0-rc56 (idem 48) the custom example does not display and generated one from schema is displayed in place
simple_swagger2_test_with_x-examples.txt
any idea if I'm doing something wrong or if there is a bug somewhere ?
thx a lot
The text was updated successfully, but these errors were encountered: