Comments (7)
Support for Swagger v2.x was added in December 2015 and we now have partial fixes for some of the path template issues
The plug-in now supported for paths like:
/books/{id}/cover
/library/shelves/{shelfId}/book/{id?}
There is no support for paths like
/books/{id*}
/books/{id*3}
You still need to declare the path params in the routes validate
object
validate: {
params: {
shelfId: Joi.string().required()
id: Joi.string().optional()
},
}
Sorry it took so long
from hapi-swagger.
Hi sorry its taken a while to get back to you.
Had a look at the Swagger spec and it looks like it only works with optional parameters for form and querystrings, but not path parameters. This is one of area where HAPI has wider functionality than Swagger.
It would be possible to fix this, you would need to modify the swagger.js file function SwaggerOperation.prototype.urlify. I am trying not to make this type of change as it will make the plug-in harder to maintain. The swagger.js file is updated quite often. You could of course fork the project and do it yourself. If enough people want this, I will consider making the changes needed.
from hapi-swagger.
Hi,
I just ran into the same issue.
+1
from hapi-swagger.
+1, would like to see this "fixed"
from hapi-swagger.
+1 as well
from hapi-swagger.
Hi Everyone
Taken another look at this
This use case of a optional path is not supported by swagger 1.2 spec and the current swagger UI code. swagger-api/swagger-ui#380
At the bottom of the comments on the issue Tony Tam says that the issue maybe fix with swagger 2.0 spec and new swagger UI.
I am just about to start the work to move over to 2.0 swagger, so I hope there will be a fix for you somewhere down the line. I am not sure how long it going to take to rebuild the plug-in, but I will post on this issue again when I have something.
from hapi-swagger.
Glenn,
I'll try to check it out in the next few days. I just wanted to say thank you now for all the work you've done on this plugin. It keeps on getting better and you apparently have endless energy. Great work!
Jeff
from hapi-swagger.
Related Issues (20)
- 16.0.0 Release Notes
- How to achieve table in the parameters section?
- ValidationError: "contact.license" is not allowed HOT 2
- Enhancement: support ZOD validator HOT 1
- Speed slowdown on swagger.json generation HOT 2
- Is swagger.json regenerated on every server restart? HOT 2
- Feature Request/Offer: Proxy Prefix HOT 2
- Could not load content for webpack://SwaggerUIBundle/node_modules/swagger-client/es/http/index.js (Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME) HOT 1
- Static generation of swagger.json HOT 1
- Feature request: ability to set a query parameter as deprecated
- More format handled for string
- `Joi.ref`s as default values outputs a raw object HOT 1
- Failed to load API definition hapi-swagger ^17.1.0 HOT 1
- [FIX] Invalid schema on requestBody.content[multipart/form-data].schema for uploaded file on OAS3
- Swagger `queryConfigEnabled` property is not supported
- Feature Proposal: Ability to customize the `default` values for individual parameters
- OpenAPI 3.1 support
- description becomes summary
- Add more example for `auth` options from optionsreference.md
- Add a better default to auto increment model naming in hapi-swagger HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hapi-swagger.