Comments (5)
Thanks for reporting these errors. I was aware of them but since they don't affect the final swagger UI result I forgot to log them. The issue is that in our code, we use the same model to represent both fields in schemas and fields in endpoints, but the json representation of required field is different in these two types of fields. Our code ended up producing json for both format, which can certainly be improved.
from play-swagger.
Thanks for the quick answer
It don't affect the swagger UI but the validation badge will be in error and that may be harmful for a public API.
from play-swagger.
I'm getting validation errors too, which is a concern as I plan on generating cross-language bindings against the API, and anything out of spec is a liability.
Example error from swagger-validator
:
{
"schemaValidationMessages": [
{
"level": "error",
"domain": "validation",
"keyword": "type",
"message": "instance type (boolean) does not match any allowed primitive type (allowed: [\"array\"])",
"schema": {
"loadingURI": "http://json-schema.org/draft-04/schema#",
"pointer": "/definitions/stringArray"
},
"instance": {
"pointer": "/definitions/foo.bar.baz.DocumentListItem/properties/id/required"
}
},
{
"level": "error",
"domain": "validation",
"keyword": "additionalProperties",
"message": "object instance has properties which are not allowed by the schema: [\"schema\"]",
"schema": {
"loadingURI": "http://swagger.io/v2/schema.json#",
"pointer": "/definitions/schema"
},
"instance": {
"pointer": "/definitions/foo.bar.baz.DocumentListItem/properties/status"
}
}
]
}
The generated schema:
{
...
"definitions": {
"foo.bar.baz.DocumentStatusInfo": {
"properties": {
"state": {
"type": "string",
"required": true
},
"message": {
"type": "string",
"required": false
},
"timeStamp": {
"type": "string",
"required": true
}
},
"required": [
"state",
"timeStamp"
]
},
"foo.bar.baz.DocumentListItem": {
"properties": {
"id": {
"type": "string",
"required": true
},
"name": {
"type": "string",
"required": true
},
"status": {
"required": true,
"schema": {
"$ref": "#/definitions/foo.bar.baz.DocumentStatusInfo"
}
}
},
"required": [
"id",
"name",
"status"
]
}
}
...
}
from play-swagger.
@metasim we have the same plan on "generating cross-language bindings against the API" as well, so we also need to a) fix this bug and b) add swagger validator. Any contribution will be much appreciated.
from play-swagger.
I think this is already fixed thanks to #78, please help test.
from play-swagger.
Related Issues (20)
- Request parameters not visible in Swagger ui
- Open API spec generated is incorrect
- Swagger generating type zoneddatetime in the swagger json
- Support for Optional in schemas
- Swagger Custom Mappings not working with multiples parameters HOT 1
- array[byte] transforms to array-byte .Must transform string
- Swagger-ui compatibility HOT 4
- How to request a release? HOT 2
- Which PLAY versions must be supported? HOT 2
- Please release 0.11.0 HOT 2
- Allow passing classloader to DefinitionGenerator HOT 1
- Definitions description based on Scaladoc HOT 2
- Please Release 0.13.0
- Reusable enums are not working HOT 1
- Skip routes w/ no Swagger Spec comment HOT 1
- java.util.zip.ZipException: duplicate entry: public/swagger.json HOT 1
- Support Scala 3 HOT 2
- Wildcard matching for `swaggerDomainNameSpaces` HOT 1
- [Urgent] Deployment Failures of This Repository Since April. HOT 4
- Remove Swagger Json from Public Folder 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 play-swagger.