Skip to content
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

Validation errors on generated Swagger JSON #28

Closed
hmpatel opened this issue Sep 2, 2015 · 1 comment
Closed

Validation errors on generated Swagger JSON #28

hmpatel opened this issue Sep 2, 2015 · 1 comment

Comments

@hmpatel
Copy link

hmpatel commented Sep 2, 2015

I generated following swagger json from my sample project, however on loading this up on Swagger online editor, it gives following validation errors. Is this a specification mismatch issue or something?

Swagger JSON:
{
"basePath": "/",
"definitions": {
"definition#1": {
"properties": {
"cause": {
"type": "string"
},
"error": {
"type": "string"
},
"errorCode": {
"type": "string"
}
}
},
"definition#2": {
"properties": {
"cause": {
"type": "string"
},
"error": {
"type": "string"
},
"errorCode": {
"type": "string"
}
}
}
},
"host": "example.com",
"info": {
"title": "sample-service",
"version": "1.0.0-SNAPSHOT"
},
"paths": {
"/api/health": {
"get": {
"consumes": [],
"parameters": [],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK",
"headers": {}
}
}
}
},
"/api/v1/resourceA": {
"post": {
"consumes": [
"application/json"
],
"parameters": [
{
"in": "header",
"name": "X-Interface-Name",
"required": true,
"type": "string"
},
{
"in": "header",
"name": "X-ABC-Client-App-ID",
"required": true,
"type": "string"
},
{
"in": "body",
"name": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"produces": [],
"responses": {
"204": {
"description": "No Content",
"headers": {}
},
"400": {
"description": "Bad Request",
"headers": {},
"schema": {
"$ref": "definition#1"
}
},
"500": {
"description": "Internal Server Error",
"headers": {},
"schema": {
"$ref": "definition#2"
}
}
}
}
}
},
"schemas": [
"http"
],
"swagger": "2.0"
}

Validation Errors

✖ Swagger Error
Additional properties not allowed: schemas
Details
Object
code: "OBJECT_ADDITIONAL_PROPERTIES"
message: "Additional properties not allowed: schemas"
path: Array [0]
level: 900

@sdaschner
Copy link
Owner

Hi, yes this has already been fixed and will be published in the next version.

For those who can't wait ;-) add:

<pluginRepositories>
    <pluginRepository>
        <id>ossrh-snapshots</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

and set the JAX-RS Analyzer version to 0.8-SNAPSHOT in your pom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants