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

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

Open
mpet opened this issue Jun 25, 2024 · 0 comments
Open

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

mpet opened this issue Jun 25, 2024 · 0 comments

Comments

@mpet
Copy link

mpet commented Jun 25, 2024

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

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

1 participant