swagger-api / swagger-api/swagger-parser

Swagger parser could not read local json files..

Open
#767 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

I am trying to use swagger parser in my Spring Boot application. Below are the steps I have followed.

  1. Added dependency in Pom.xml (As mentioned in https://github.com/swagger-api/swagger-parser)
  2. Copied the swagger-Josn template to "src/main/resources/json/"
  3. I tried to load the swagger_json templates in the code as below
    Swagger swagger = new SwaggerParser().read("/src/main/resources/json/swagger_new.json");

When this code gets executed, the parser could not read the file.
I found that the "swagger" is null.

Could any one please let me the right way to read the json from a location.

Your support will be greatly appreciated.

Thanks in advance.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The entry point is SwaggerParser().read(...) in the Spring Boot application; begin by checking how the JSON under src/main/resources/json/ is being addressed and whether the parser receives that path. Done means the local swagger_new.json is read successfully and the Swagger object is non-null.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.