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

missing Java code generation #1419

Closed
Markus-Elfring opened this issue Aug 1, 2022 · 4 comments
Closed

missing Java code generation #1419

Markus-Elfring opened this issue Aug 1, 2022 · 4 comments

Comments

@Markus-Elfring
Copy link

I am trying the current software release out.

Markus_Elfring@…:~/Downloads/Freeware/jsonschema2pojo-1.1.2/bin> sh jsonschema2pojo -s ~/Test/JSON/Schemas/GTIN-simple-Schema1.json -t ~/Bau/JSON/Schemas/GTIN

Now I wonder why I do not see that desired Java source files were generated in the specified target directory according to my simple JSON schema example.

{
  "$schema": "http://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/schemas/GTIN-13",
  "type": "string",
  "pattern": "^[0-9]{13}$"
}

🔮 How should the tool implementation be improved further?

@unkish
Copy link
Collaborator

unkish commented Aug 1, 2022

Hi

What would be the expected generated output for given schema ?

@Markus-Elfring
Copy link
Author

💭 I would expect that some Java code should be generated for the validation of an input string according to the specified regular expression.
I became curious how the corresponding source code would look like.

@joelittlejohn
Copy link
Owner

This library doesn't perform validation. This is a huge task, and one best left to schema validation libraries.

You might be interested to look at JSR 303 though (or Jakarta validation) as the annotations can be turned on in jsonschema2pojo. You can then use a bean validator.

@Markus-Elfring
Copy link
Author

Markus-Elfring commented Aug 1, 2022

This library doesn't perform validation.

I wonder how this feedback fits to the desire for data type safety which should be achieved together with complete applications of the JSON schema specification (including the usage of patterns).

🔮 Will the support evolve any further for the data processing with regular expressions?

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

3 participants