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

Unable to import Swagger link: Unable to parse the Swagger content. #650

Open
abdulazizfmw opened this issue Jul 18, 2023 · 3 comments
Open

Comments

@abdulazizfmw
Copy link

Describe the bug
Unable to import Swagger link: Unable to parse the Swagger content.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Project
  2. Import swagger by Link : https://petstore.swagger.io/#/
  3. See error
2023-07-18 12:39:20 java.lang.IllegalArgumentException: Unable to parse the Swagger content.
2023-07-18 12:39:20     at com.castlemock.service.mock.rest.project.converter.swagger.SwaggerRestDefinitionConverter.convertSwagger(SwaggerRestDefinitionConverter.java:158) ~[service-mock-rest-1.63.jar:?]
2023-07-18 12:39:20     at com.castlemock.service.mock.rest.project.converter.swagger.SwaggerRestDefinitionConverter.convert(SwaggerRestDefinitionConverter.java:135) ~[service-mock-rest-1.63.jar:?]
2023-07-18 12:39:20     at com.castlemock.service.mock.rest.project.ImportRestDefinitionService.process(ImportRestDefinitionService.java:67) ~[service-mock-rest-1.63.jar:?]
2023-07-18 12:39:20     at com.castlemock.service.core.ServiceProcessorImpl.process(ServiceProcessorImpl.java:85) ~[service-core-1.63.jar:?]

Expected behavior
Swagger imported and generate the mock

Screenshots
Valid swagger link
https://petstore.swagger.io/#/
image

Note: the mock generated by uploading the swagger file:

image

Castle Mock

  • Version 1.63
  • Java Version 11
@abdulazizfmw
Copy link
Author

abdulazizfmw commented Jul 18, 2023

@karldahlgren
Same issue with the latest Docker image 1.65

@karldahlgren
Copy link
Collaborator

Hi @abdulazizfmw.
The provided link is not a valid Swagger definition file. The correct URL would be the following in this scenario: https://petstore.swagger.io/v2/swagger.json

@abdulazizfmw
Copy link
Author

Thanks
It is working

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