$schema is null but the value of $schema should be string

Open
#2,107 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
java
Domain
api

Research direction

Reproduce the report using the linked TS28532_FaultMnS.yaml file and the OpenAPIV3Parser().readLocation entry point. Inspect how NotifyNewAlarm is obtained from openAPI.getComponents().getSchemas() and converted through ObjectMapper and JSONObject, then determine why $schema is null and verify the expected value with a focused parser test.

Written by the indexing model from the issue text.

Description

Hi,

I am trying this code and parsing https://forge.3gpp.org/rep/sa5/MnS/-/blob/Integration_Rel16_SA5_155_YAML/OpenAPI/TS28532_FaultMnS.yaml

    ParseOptions parseOptions = new ParseOptions();
    parseOptions.setResolve(true); // implicit
    parseOptions.setResolveFully(true);
   String openApiSpec = schemaReference.getUrl(); // Replace with the actual path to your OpenAPI file
    SwaggerParseResult result = new OpenAPIV3Parser().readLocation(openApiSpec, null, null);
    if (result.getMessages().isEmpty()) {
        OpenAPI openAPI = result.getOpenAPI();

        // Extract the schema from the OpenAPI specification
        ObjectMapper mapper = new ObjectMapper();
        JsonNode schemaNode = mapper.convertValue(
               openAPI.getComponents().getSchemas().get("NotifyNewAlarm"), JsonNode.class);
       
        
        // Convert the schemaNode to JSONObject
       JSONObject jsonSchema = new JSONObject(new JSONTokener(schemaNode.toString()));

image

As you can see the $schema is null but the value of $schema should be string.

Any ideas what I am lacking?

//mike

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

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.

More from swagger-api/swagger-parser

All issues in swagger-api/swagger-parser

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.