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

Having issues with validating swagger.json file #702

Closed
rameshappat opened this issue May 20, 2016 · 8 comments
Closed

Having issues with validating swagger.json file #702

rameshappat opened this issue May 20, 2016 · 8 comments

Comments

@rameshappat
Copy link

Hello,
I have written a swagger.json file. The post operation contains two path parameters and one body parameter. the Body parameter type is defined in another JSON file and has other references etc.
I am trying to validate the file in the editor and keeps coming back with reference errors. Also I am trying to run this using Swagger UI and the body text box appears but the data type is not resolved to the correct complex type.

@wparad
Copy link

wparad commented May 20, 2016

is #275 or Reuse relevant?

@fehguy
Copy link
Contributor

fehguy commented May 20, 2016

share your definition, please?

@fehguy
Copy link
Contributor

fehguy commented May 20, 2016

Please reopen this in the swagger-js project, the resolution is implementation specific.

@fehguy fehguy closed this as completed May 20, 2016
@rameshappat
Copy link
Author

Here is the Swagger.json file.
It is hosted in a web server which has path of http://localhost:8080/dist/swagger.jsonhttp://localhost:8080/dist/swagger.json
The other external definition files are all in the dist directory

{
"swagger": "2.0",
"x-otm-resource": {
"namespace": "http://www.travelport.com/schema/catalog/air/v0",
"localName": "AirProduct"
},
"info": {
"version": "1.0.0",
"title": "ReservationResource API Specification"

},
"host": "localhost:8080",
"basePath": "/",
"schemes": [
"http"
],

"paths": {
"/interactions/{interactionid}/reservation/{reservationid}": {
"post": {
"summary": "ReservationResource - Post",
"operationId": "Post",
"consumes":[
"application/json",
"application/xml"
],
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"name": "interactionid",
"in": "path",
"description": "Interaction ID",
"required": true,
"type": "string"
},
{
"name": "reservationid",
"in": "path",
"description": "Reservation ID",
"required": true,
"type": "string"
},
{
"name": "reservation",
"in": "body",
"description": "reservation object",
"required": true,
"schema": {
"$ref": "http://localhost:8080/dist/ReservationDomain_2_0_0.schema.json"
}
}
],
"responses": {
"200": {
"description": "Retrieves a 1G Booking"
}
}
}
}
}
}


From: Warren Parad [notifications@github.com]
Sent: Thursday, May 19, 2016 9:29 PM
To: OAI/OpenAPI-Specification
Cc: Appat, Ramesh (Cognizant); Author
Subject: Re: [OAI/OpenAPI-Specification] Having issues with validating swagger.json file (#702)

is #275<redir.aspx?REF=p_guewmLkKpyCsA29JRw-R8GolvqYjGhvECokQbN8xIUKeskuoDTCAFodHRwczovL2dpdGh1Yi5jb20vT0FJL09wZW5BUEktU3BlY2lmaWNhdGlvbi9pc3N1ZXMvMjc1> or Reuse<redir.aspx?REF=_mp2nTfBVZnKPjqTShuYZV0aHuhsD8pEbTuDEd6Yr30UKeskuoDTCAFodHRwczovL2dpdGh1Yi5jb20vT0FJL09wZW5BUEktU3BlY2lmaWNhdGlvbi9ibG9iL21hc3Rlci9ndWlkZWxpbmVzL1JFVVNFLm1kI3JlbW90ZS1yZWZlcmVuY2Vz> relevant?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub<redir.aspx?REF=TYzQHGLHKiB1GQBJO88KrjE5Hi5A1eJZMkQ9-zHAwj8UKeskuoDTCAFodHRwczovL2dpdGh1Yi5jb20vT0FJL09wZW5BUEktU3BlY2lmaWNhdGlvbi9pc3N1ZXMvNzAyI2lzc3VlY29tbWVudC0yMjA1MDg4ODg.>

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.

@rameshappat
Copy link
Author

here is the swagger JSON file.
it is hosted in a webserver and the path is http://localhost:8080/dist/Swagger.jsonhttp://localhost:8080/dist/Swagger.json
All the definition files are in the dist directory.
What is the relative or actual path to use to reference my definition? is it relative to the location of Swagger file or the API paths?

{
"swagger": "2.0",
"x-otm-resource": {
"namespace": "http://www.travelport.com/schema/catalog/air/v0",
"localName": "AirProduct"
},
"info": {
"version": "1.0.0",
"title": "ReservationResource API Specification"

},
"host": "localhost:8080",
"basePath": "/",
"schemes": [
"http"
],

"paths": {
"/interactions/{interactionid}/reservation/{reservationid}": {
"post": {
"summary": "ReservationResource - Post",
"operationId": "Post",
"consumes":[
"application/json",
"application/xml"
],
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"name": "interactionid",
"in": "path",
"description": "Interaction ID",
"required": true,
"type": "string"
},
{
"name": "reservationid",
"in": "path",
"description": "Reservation ID",
"required": true,
"type": "string"
},
{
"name": "reservation",
"in": "body",
"description": "reservation object",
"required": true,
"schema": {
"$ref": "http://localhost:8080/dist/ReservationDomain_2_0_0.schema.json"
}
}
],
"responses": {
"200": {
"description": "Retrieves a 1G Booking"
}
}
}
}
}
}


From: Tony Tam [notifications@github.com]
Sent: Thursday, May 19, 2016 9:46 PM
To: OAI/OpenAPI-Specification
Cc: Appat, Ramesh (Cognizant); Author
Subject: Re: [OAI/OpenAPI-Specification] Having issues with validating swagger.json file (#702)

share your definition, please?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub<redir.aspx?REF=yj5Zv2JMuUW2gB6HcHOCWV_keZY9hzFTzCxp4clzVHSNuW6yuoDTCAFodHRwczovL2dpdGh1Yi5jb20vT0FJL09wZW5BUEktU3BlY2lmaWNhdGlvbi9pc3N1ZXMvNzAyI2lzc3VlY29tbWVudC0yMjA1MTA1MDY.>

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.

@fehguy
Copy link
Contributor

fehguy commented May 20, 2016

Please open the issue in swagger-parser and share the contents of this:

http://localhost:8080/dist/ReservationDomain_2_0_0.schema.json

as it's referenced in your definition.

@rameshappat
Copy link
Author

The swagger instance comes back as Null as I tried to do a toString on the object.
But when I tried to parse swagger.json, it came back with the following exception:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.RuntimeException: An exception was thrown while trying to deserialize the contents of http://localhost:8080/dist/ReservationDomain_2_0_0.schema.json into type interface io.swagger.models.Model
at io.swagger.parser.util.DeserializationUtils.deserialize(DeserializationUtils.java:54)
at io.swagger.parser.ResolverCache.loadRef(ResolverCache.java:102)
at io.swagger.parser.processors.ExternalRefProcessor.processRefToExternalDefinition(ExternalRefProcessor.java:26)
at io.swagger.parser.processors.ModelProcessor.processRefModel(ModelProcessor.java:92)
at io.swagger.parser.processors.ModelProcessor.processModel(ModelProcessor.java:33)
at io.swagger.parser.processors.ParameterProcessor.processParameters(ParameterProcessor.java:44)
at io.swagger.parser.processors.OperationProcessor.processOperation(OperationProcessor.java:26)
at io.swagger.parser.processors.PathsProcessor.processPaths(PathsProcessor.java:72)
at io.swagger.parser.SwaggerResolver.resolve(SwaggerResolver.java:40)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:66)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:52)
at Testing.main(Testing.java:9)
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source:

There are currently 0 running SoapUI MockServices

    ; line: 1, column: 2]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1576)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:533)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:462)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1624)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:689)
    at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3105)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3051)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2161)
    at io.swagger.parser.util.DeserializationUtils.deserialize(DeserializationUtils.java:48)
    ... 11 more

    From: Tony Tam [mailto:notifications@github.com]
    Sent: Friday, May 20, 2016 8:44 AM
    To: OAI/OpenAPI-Specification OpenAPI-Specification@noreply.github.com
    Cc: Appat, Ramesh (Cognizant) Ramesh.Appat@cognizant.com; Author author@noreply.github.com
    Subject: Re: [OAI/OpenAPI-Specification] Having issues with validating swagger.json file (#702)

    Please open the issue in swagger-parser and share the contents of this:

    http://localhost:8080/dist/ReservationDomain_2_0_0.schema.json

    as it's referenced in your definition.


    You are receiving this because you authored the thread.
    Reply to this email directly or view it on GitHubhttps://github.com//issues/702#issuecomment-220625194

    This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.

    @webron
    Copy link
    Member

    webron commented May 20, 2016

    @rameshappat you've repeatedly been asked to open a ticket on the right repository. I have no choice but to lock this topic.

    @OAI OAI locked and limited conversation to collaborators May 20, 2016
    Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants