-
Notifications
You must be signed in to change notification settings - Fork 28
Introduce schema reference support #30
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
base: main
Are you sure you want to change the base?
Changes from all commits
8ee4733
3778dfb
78d2f2d
d61f2e6
7a0839e
b10ea21
7df9847
98ecf35
8f026d8
431017c
7682699
d088f91
6de34fa
ba1bf50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,13 +16,20 @@ | |
|
|
||
| package org.springframework.cloud.schema.registry.model; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| import javax.persistence.Column; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.Lob; | ||
| import javax.persistence.ManyToMany; | ||
| import javax.persistence.Table; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIdentityInfo; | ||
| import com.fasterxml.jackson.annotation.JsonIdentityReference; | ||
| import com.fasterxml.jackson.annotation.ObjectIdGenerators; | ||
|
|
||
| /** | ||
| * @author Vinicius Carvalho | ||
| * | ||
|
|
@@ -46,8 +53,12 @@ public class Schema { | |
| @Column(name = "FORMAT", nullable = false) | ||
| private String format; | ||
|
|
||
| @Lob | ||
| @Column(name = "DEFINITION", nullable = false, length = 8192) | ||
| @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "subject") | ||
| @JsonIdentityReference(alwaysAsId = true) | ||
| @ManyToMany | ||
| private List<Schema> references = new ArrayList<>(); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another issue I stumbled upon, since now instead of returning all as opposed to: This however, now breaking tests since I am not entirely sure how to solve this for now.
What do you think? |
||
|
|
||
| @Column(name = "DEFINITION", columnDefinition = "text", nullable = false, length = 8192) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed when using PostgreSQL. It was replaced by References: |
||
| private String definition; | ||
|
|
||
| public Integer getId() { | ||
|
|
@@ -82,6 +93,22 @@ public void setFormat(String format) { | |
| this.format = format; | ||
| } | ||
|
|
||
| public List<Schema> getReferences() { | ||
| return this.references; | ||
| } | ||
|
|
||
| public void setReferences(List<Schema> references) { | ||
| this.references = references; | ||
| } | ||
|
|
||
| public void addReference(Schema schemaReference) { | ||
| this.references.add(schemaReference); | ||
| } | ||
|
|
||
| public void removeReference(Schema schemaReference) { | ||
| this.references.remove(schemaReference); | ||
| } | ||
|
|
||
| public String getDefinition() { | ||
| return this.definition; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method needs some refactoring.
Can you advice any "springy" way of doing schema reference resolution (header parsing, schema fetching, etc)?