-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Body parameters with inline schema definitions are not rendered properly #1133
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
Comments
Confirmed bug in master. |
I have confirmed this also, FWIW. |
I ran into this issue today, I think. Will the merged fix referenced above from the swagger-js project also fix property refs? In the following situation, the model/model schema are missing in the UI: Global definition in // ...
"media_experiment": {
"type": "object",
"required": [],
"properties": {
"name": {
"type": "string"
},
"src": {
"type": "string"
},
"media_file": {
"properties": {
"file_type": {
"type": "string"
},
"base64": {
"type": "string"
}
},
"type": "object"
},
"media_ids": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
},
"media_array": {
"type": "array",
"items": {
"description": "Media model",
"required": ["id"],
"properties": {
"id": {
"type": "integer",
"description": "Media's id",
"format": "int32"
},
"name": {
"type": "string",
"description": "Media's name"
},
"description": {
"type": "string",
"description": "Media's description"
},
"caption": {
"type": "string",
"description": "Media's caption"
}
},
"type": "object"
}
},
"custom_array": {
"type": "array",
"items": {
"properties": {
"foo": {
"type": "string"
},
"bar": {
"type": "string"
}
},
"type": "object"
}
}
}
},
// ... In the Operation object: // ...
"parameters": [{
"name": "body",
"in": "body",
"schema": {
"properties": {
"media": {
"$ref": "#/definitions/media_experiment"
}
},
"type": "object"
}
}],
// ... As @davazp Mentioned, if I remove the nested schema for the Or maybe I have a malformed json config lol... |
Btw, I am using the dist files from |
@Smolations the fix is in swagger-js at the moment, it'll take some time to see it in swagger-ui, which relies on the npm module of swagger-js. If you like, I can show you how I build the bleeding edge swagger-ui. Otherwise it'll be in a release soon. |
Shouldn't be a problem to build it. @ponelat - please provide with the details. |
to build from latest sources... Here's a quick recap for a fresh start... cd /some/where
git clone https://github.com/swagger-api/swagger-ui
cd ./swagger-ui
git checkout develop_2.0
# go back up a folder, as we were in ./swagger-ui
cd ..
git clone https://github.com/swagger-api/swagger-js
cd ./swagger-js
git checkout develop_2.0 Now you should have fresh copies of the good stuff. If you already had the repos cloned, just run For the fun bit (isn't debugging fun :) ) Look for this line... ...
gulp.src([
'./src/main/javascript/**/*.js',
'./node_modules/swagger-client/browser/swagger-client.js' // <------ This line
... And change it to something like this... ...
gulp.src([
'./src/main/javascript/**/*.js',
'../swagger-js/browser/swagger-client.js' // <------ This must point to the repo we cloned above
... Now you're good to build.... cd /some/where/swagger-js
npm install
gulp build
cd ../swagger-ui
npm install
gulp Voila! That felt way.... too long for something so simple. Which means I'm going to try and make this a feature in swagger-ui. # This would be easier, no?
gulp --client-path=../swagger-js/browser/swagger-client.js @webron, should we make this feature a reality? |
what feature? |
@webron, the feature to build from the edge sources. |
That's probably better for @fehguy / @mohsen1 / @whitlockjc to reply. |
@ponelat I agree this is kinda nasty. I think adding a commandline param is fine, it'll probably be used by swagger-ui developers only, which is fine by me! |
Thanks guys, that is GREAT info! And btw, for anyone else reading, the manual build totally worked! |
The following path is not rendered correctly. The data type shows
undefined
instead of the model/schema. It will work if I replace the schema definition for a$ref
The text was updated successfully, but these errors were encountered: