question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nothing happens, unable to generate from OpenAPI JSON Schema

See original GitHub issue

I am trying to leverage the OpenAPI JSON Schema, to validate some user provided OpenAPI definitions. When trying to use the maven-plugin or the jsonschema2pojo website, I get no results.

JSON Schema: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json

             <plugin>
                <groupId>org.jsonschema2pojo</groupId>
                <artifactId>jsonschema2pojo-maven-plugin</artifactId>
                <version>1.1.2</version>
                <configuration>
                    <sourceType>jsonschema</sourceType>
                    <sourceDirectory>${basedir}/src/main/resources/schemas</sourceDirectory>
                    <targetPackage>com.example.openapi</targetPackage>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
eirnymcommented, Jul 11, 2022

Yes, this has been changed since version 2019-09. Versions below (e.g. draft-0[1-7]) has this explicit restriction

0reactions
joelittlejohncommented, Jul 11, 2022

It’s possible to have a JSON schema with no meaningful rules or types to generate. This means the plugin has done its work but there is nothing to do.

Until recent versions, the JSON schema spec explicitly mentioned that the presence of $ref in a schema should mean that all other keys in the schema must be ignored. So this is what jsonschema2pojo does. I believe that this may have changed in recent versions of the JSON schema spec, however we should find an explicit reference.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] [Online Generator] silently fails and seemingly does ...
Go to the online generator (stable or master, same on both) · Upload any valid json spec ...
Read more >
What does the "Unrecognized token openapi" error mean ...
I'm currently working on openapi-generator-maven-plugin to generate Java classes from an OpenAPI JSON schema. The errors looks like a syntax problem.
Read more >
OpenAPI and JSON Schema: When to Use Which
As an API architect who wants to follow this quick fix, this means that a pure JSON Schema draft will be your Rosetta...
Read more >
openapi-typescript - npm
Convert static OpenAPI schemas to TypeScript types quickly using pure Node.js. Fast, lightweight, (almost) dependency-free, and no Java/node- ...
Read more >
Solving OpenAPI and JSON Schema Divergence - Medium
Step 1: Converting OpenAPI to JSON Schema · Strip $schema and id from root, which are both invalid keywords in OpenAPI · Switches...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found