I am starting to use the JSON Schema to java pojo in one of the projects I am working on (org.jsonschema2pojo). I have sucessfully referenced one schema inside the other one and I can see the same info is there. However, the json schema where I use the reference instead of referncing the pojo of the original one creates a new file with the exact same information. Example:
Json Schema A:
{
"$schema": "https://json-schema.org/draft/2020-12/schema#",
"$id": "https://example.com/schemas/A",
"description": "Some Json Schema",
"type": "object",
"properties": {
"genericInfo": {
"type": "string",
"description": "Some generic info"
}
}
"required": ["genericInfo"]
}
Json Schema B :
{
"$schema": "https://json-schema.org/draft/2020-12/schema#",
"$id": "https://example.com/schemas/B",
"description": "Some Json Schema B",
"type": "object",
"properties": {
"referenceToA": {
"$ref": "../jsonSchemaA.json"
}
}
}
My POJO of B has the information of A but instead of referencing the same file it creates a new file with the same name + information. Is there a way to stop this from happening? Is this a known Issue? Since I need to reference schemas between them but use common pojos in a lot of them I would need to always cast it to the original one if I can´t solve this issue.
Thanks in advance