How to specify the "id" URI?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- backend-api-design
Research direction
Start with the getSchema entry point and trace how HyperSchemaFactoryWrapper and ObjectMapper handle the Article.author User relationship. Compare the generated schema with the expected $ref to determine whether URI configuration is supported; done means the author property references the User schema at the specified URI.
Written by the indexing model from the issue text.
Description
I have two classes: Article and User and their respective schemas are available at:
- http://localhost:8080/api/articles/$schema
- http://localhost:8080/api/users/$schema
Since Article.author is of type User, how can I have the correct $ref in the schema? Now I'm getting this:
{
"type":"object",
"properties":{
"id":{
"type":"integer"
},
"title":{
"type":"string"
},
"author":{
"type":"object",
"id":"urn:jsonschema:it:saiv:best:common:entity:User",
"properties":{
"id":{
"type":"integer"
},
"cn":{
"type":"string"
}
}
}
}
}
but I would expect something like:
{
"type":"object",
"properties":{
"id":{
"type":"integer"
},
"title":{
"type":"string"
},
"author":{
"$ref":"http://localhost:8080/api/users/$schema"
}
}
}
This is the code I'm using to generate the schema:
@GET
@Path("/$schema")
@Produces(MediaType.APPLICATION_JSON)
public String getSchema() throws IOException {
HyperSchemaFactoryWrapper visitor = new HyperSchemaFactoryWrapper();
ObjectMapper mapper = new ObjectMapper();
mapper.acceptJsonFormatVisitor(Article.class, visitor);
JsonSchema schema = visitor.finalSchema();
return mapper.writeValueAsString(schema);
}
- Dominant language
- Java
- Stars
- 387
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FasterXML/jackson-module-jsonSchema
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
FasterXML/jackson-module-jsonSchema#160 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
pr-needed
Difficulty 3/5 1-2 days Newbie friendliness 30/100
FasterXML/jackson-module-jsonSchema#136 · 10 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
FasterXML/jackson-module-jsonSchema#135 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
FasterXML/jackson-module-jsonSchema#134 · 2 comments · 1 reaction ·
All issues in FasterXML/jackson-module-jsonSchema
Similar issues
-
status: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
spring-projects/spring-ai#7206 ·
Maintainers usually reply within 2 days
-
area/cli
Difficulty 2/5 Half a day Newbie friendliness 78/100
quarkusio/quarkus#57623 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jhipster/prettier-java#1113 ·
Maintainers usually reply within 2 days
-
bug follow-up lane:backlog
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Sanne/incus-spawn#1576 · 1 comment ·
Maintainers usually reply within 1 day
-
Pasting code into a comment adds imports for the pasted codePossibly taken @ravnskjaer claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
eclipse-jdt/eclipse.jdt.ui#3275 · 1 comment ·
Maintainers usually reply within 1 day