Skip to content

Commit e04d8e9

Browse files
authored
Merge pull request #116 from FamilySearch/gedcomx-schema-updates
Gedcomx schema updates for OpenAPI
2 parents bea8215 + b1b2e88 commit e04d8e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+638
-2
lines changed

gedcomx-model/src/main/java/org/gedcomx/Gedcomx.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
import org.gedcomx.types.ResourceType;
4444

4545
import javax.xml.XMLConstants;
46+
47+
import io.swagger.v3.oas.annotations.media.Schema;
4648
import jakarta.xml.bind.annotation.*;
4749
import java.text.DateFormat;
4850
import java.util.ArrayList;
@@ -90,20 +92,50 @@
9092
@JsonElementWrapper ( name = "gedcomx" )
9193
@JsonInclude ( JsonInclude.Include.NON_NULL )
9294
@XmlType ( name = "Gedcomx", propOrder = {"attribution", "persons", "relationships", "sourceDescriptions", "agents", "events", "places", "documents", "collections", "fields", "recordDescriptors"} )
95+
@Schema(name = "The GEDCOM X data formats define the serialization formats of the GEDCOM X conceptual model. The canonical documentation is provided by the formal specification documents:" +
96+
" [The GEDCOM X Conceptual Model, Version 1.0](https://github.com/FamilySearch/gedcomx/blob/master/specifications/conceptual-model-specification.md)" +
97+
" [The GEDCOM X JSON Format, Version 1.0](https://github.com/FamilySearch/gedcomx/blob/master/specifications/json-format-specification.md)" +
98+
" [The GEDCOM X XML Format, Version 1.0](https://github.com/FamilySearch/gedcomx/blob/master/specifications/xml-format-specification.md)" +
99+
"This documentation is provided as a non-normative reference guide.")
93100
public class Gedcomx extends HypermediaEnabledData implements HasFields {
94101

102+
@Schema(description = "The language of this genealogical data set. See http://www.w3.org/International/articles/language-tags/. " +
103+
"Note that some language-enabled elements MAY override the language.")
95104
private String lang;
105+
106+
@Schema(description = "A reference to a description of this data set.")
96107
private URI descriptionRef;
108+
109+
@Schema(description = "The attribution of this genealogical data.")
97110
private Attribution attribution;
111+
112+
@Schema(description = "The persons included in this genealogical data set.")
98113
private List<Person> persons;
114+
115+
@Schema(description = "The relationships included in this genealogical data set.")
99116
private List<Relationship> relationships;
117+
118+
@Schema(description = "The descriptions of sources included in this genealogical data set.")
100119
private List<SourceDescription> sourceDescriptions;
120+
121+
@Schema(description = "The agents included in this genealogical data set.")
101122
private List<Agent> agents;
123+
124+
@Schema(description = "The events included in this genealogical data set.")
102125
private List<Event> events;
126+
127+
@Schema(description = "The places included in this genealogical data set.")
103128
private List<PlaceDescription> places;
129+
130+
@Schema(description = "The documents included in this genealogical data set.")
104131
private List<Document> documents;
132+
133+
@Schema(description = "The collections included in this genealogical data set.")
105134
private List<Collection> collections;
135+
106136
private List<Field> fields;
137+
138+
@Schema(description = "The record descriptors included in this genealogical data set.")
107139
private List<RecordDescriptor> recordDescriptors;
108140

109141
public Gedcomx() {

gedcomx-model/src/main/java/org/gedcomx/agent/Address.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.gedcomx.agent;
1717

18+
import io.swagger.v3.oas.annotations.media.Schema;
19+
1820
import org.gedcomx.common.ExtensibleData;
1921

2022
import jakarta.xml.bind.annotation.XmlType;
@@ -26,18 +28,40 @@
2628
* @author Ryan Heaton
2729
*/
2830
@XmlType ( name = "Address" )
31+
@Schema(description = "An Address.")
2932
public class Address extends ExtensibleData {
3033

34+
@Schema(description = "The city.")
3135
private String city;
36+
37+
@Schema(description = "The country.")
3238
private String country;
39+
40+
@Schema(description = "The postal code.")
3341
private String postalCode;
42+
43+
@Schema(description = "The state or province.")
3444
private String stateOrProvince;
45+
46+
@Schema(description = "The street.")
3547
private String street;
48+
49+
@Schema(description = "Additional street information.")
3650
private String street2;
51+
52+
@Schema(description = "Additional street information.")
3753
private String street3;
54+
55+
@Schema(description = "Additional street information.")
3856
private String street4;
57+
58+
@Schema(description = "Additional street information.")
3959
private String street5;
60+
61+
@Schema(description = "Additional street information.")
4062
private String street6;
63+
64+
@Schema(description = "The value of the property, if it can be expressed as a string.")
4165
private String value;
4266

4367
public Address() {

gedcomx-model/src/main/java/org/gedcomx/agent/Agent.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.fasterxml.jackson.annotation.JsonInclude;
2020
import com.fasterxml.jackson.annotation.JsonProperty;
2121
import com.webcohesion.enunciate.metadata.rs.TypeHint;
22+
import io.swagger.v3.oas.annotations.media.Schema;
2223
import org.gedcomx.common.ResourceReference;
2324
import org.gedcomx.common.TextValue;
2425
import org.gedcomx.common.URI;
@@ -34,7 +35,6 @@
3435
import jakarta.xml.bind.annotation.XmlTransient;
3536
import jakarta.xml.bind.annotation.XmlType;
3637

37-
import java.sql.Array;
3838
import java.util.ArrayList;
3939
import java.util.List;
4040

@@ -50,16 +50,34 @@
5050
@XmlType ( name = "Agent" )
5151
@JsonElementWrapper ( name = "agents" )
5252
@JsonInclude ( JsonInclude.Include.NON_NULL )
53+
@Schema(description = "An agent, e.g. person, organization, or group. In genealogical research, an agent often takes the role of a contributor.")
5354
public class Agent extends HypermediaEnabledData {
5455

56+
@Schema(description = "The list of names for the agent.")
5557
private List<TextValue> names;
58+
59+
@Schema(description = "The list of identifiers for the agent.")
5660
private List<Identifier> identifiers;
61+
62+
@Schema(description = "The homepage of the person or organization. Note this is different from the homepage of the service where the person or organization has an account.")
5763
private ResourceReference homepage;
64+
65+
@Schema(description = "The openid of the person or organization.")
5866
private ResourceReference openid;
67+
68+
@Schema(description = "The accounts that belong to this person or organization.")
5969
private List<OnlineAccount> accounts;
70+
71+
@Schema(description = "The emails that belong to this person or organization.")
6072
private List<ResourceReference> emails;
73+
74+
@Schema(description = "The phones that belong to this person or organization.")
6175
private List<ResourceReference> phones;
76+
77+
@Schema(description = "The addresses that belong to this person or organization.")
6278
private List<Address> addresses;
79+
80+
@Schema(description = "The person that describes this agent.")
6381
private ResourceReference person;
6482

6583
public Agent() {

gedcomx-model/src/main/java/org/gedcomx/agent/OnlineAccount.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.gedcomx.agent;
1717

18+
import io.swagger.v3.oas.annotations.media.Schema;
1819
import org.gedcomx.common.ExtensibleData;
1920
import org.gedcomx.common.ResourceReference;
2021

@@ -26,9 +27,13 @@
2627
* @author Ryan Heaton
2728
*/
2829
@XmlType( name = "OnlineAccount" )
30+
@Schema(description = "An online account for a web application.")
2931
public class OnlineAccount extends ExtensibleData {
3032

33+
@Schema(description = "The homepage of the service that provides this account.")
3134
private ResourceReference serviceHomepage;
35+
36+
@Schema(description = "The name associated the holder of this account with the account.")
3237
private String accountName;
3338

3439
public OnlineAccount() {

gedcomx-model/src/main/java/org/gedcomx/common/Attribution.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
import com.fasterxml.jackson.annotation.JsonInclude;
1919
import com.webcohesion.enunciate.metadata.Facet;
20+
import io.swagger.v3.oas.annotations.media.Schema;
21+
2022
import org.gedcomx.agent.Agent;
2123
import org.gedcomx.rt.GedcomxConstants;
2224
import org.gedcomx.rt.RDFRange;
@@ -38,13 +40,25 @@
3840
@XmlType ( name = "Attribution", propOrder = { "contributor", "modified", "changeMessage", "changeMessageResource", "creator", "created" } )
3941
@JsonInclude ( JsonInclude.Include.NON_NULL )
4042
@SuppressWarnings("gedcomx:no_id")
43+
@Schema(description = "Attribution for genealogical information. Attribution is used to model who is contributing/modifying information, when they contributed it, and why they are making the contribution/modification.")
4144
public class Attribution extends ExtensibleData {
4245

46+
@Schema(description = "Reference to the contributor of the attributed data.")
4347
private ResourceReference contributor;
48+
49+
@Schema(description = "Reference to the creator of the attributed data. The creator might be different from the contributor if the attributed data has been modified since it was created.")
4450
private ResourceReference creator;
51+
52+
@Schema(description = "The modified timestamp for the attributed data.")
4553
private Date modified;
54+
55+
@Schema(description = "The created timestamp for the attributed data.")
4656
private Date created;
57+
58+
@Schema(description = "The \"change message\" for the attributed data provided by the contributor.")
4759
private String changeMessage;
60+
61+
@Schema(description = "A reference to the change message for the attributed data provided by the contributor.")
4862
private URI changeMessageResource;
4963

5064
public Attribution() {

gedcomx-model/src/main/java/org/gedcomx/common/EvidenceReference.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import com.fasterxml.jackson.annotation.JsonInclude;
1919
import com.webcohesion.enunciate.metadata.Facet;
20+
import io.swagger.v3.oas.annotations.media.Schema;
2021
import org.gedcomx.links.HypermediaEnabledData;
2122
import org.gedcomx.links.Link;
2223
import org.gedcomx.rt.GedcomxConstants;
@@ -38,10 +39,16 @@
3839
@XmlType ( name = "EvidenceReference" )
3940
@JsonElementWrapper ( name = "evidence" )
4041
@JsonInclude ( JsonInclude.Include.NON_NULL )
42+
@Schema(description = "A reference to a resource that is being used as evidence.")
4143
public final class EvidenceReference extends HypermediaEnabledData implements Attributable {
4244

45+
@Schema(description = "The URI to the resource being referenced as evidence.")
4346
private URI resource;
47+
48+
@Schema(description = "The resource id of the resource being referenced. Used as an extension attribute when resolving the resource is inconvenient.")
4449
private String resourceId;
50+
51+
@Schema(description = "Attribution metadata for evidence reference.")
4552
private Attribution attribution;
4653

4754
public EvidenceReference() {

gedcomx-model/src/main/java/org/gedcomx/common/ExtensibleData.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.gedcomx.common;
1717

1818
import com.fasterxml.jackson.annotation.JsonIgnore;
19+
import io.swagger.v3.oas.annotations.media.Schema;
1920
import org.gedcomx.rt.SupportsExtensionElements;
2021

2122
import jakarta.xml.bind.JAXBElement;
@@ -28,10 +29,15 @@
2829
* @author Ryan Heaton
2930
*/
3031
@XmlType( name = "ExtensibleData" )
32+
@Schema(description = "A set of data that supports extension elements.")
3133
public abstract class ExtensibleData implements SupportsExtensionElements, HasTransientProperties {
3234

35+
@Schema(description = "A local, context-specific id for the data.")
3336
private String id;
37+
38+
@Schema(description = "Custom extension elements for a conclusion.")
3439
protected List<Object> extensionElements;
40+
3541
protected final Map<String, Object> transientProperties = new TreeMap<String, Object>();
3642

3743
protected ExtensibleData() {

gedcomx-model/src/main/java/org/gedcomx/common/Note.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import com.fasterxml.jackson.annotation.JsonInclude;
1919
import com.webcohesion.enunciate.metadata.Facet;
20+
import io.swagger.v3.oas.annotations.media.Schema;
2021
import org.gedcomx.links.HypermediaEnabledData;
2122
import org.gedcomx.links.Link;
2223
import org.gedcomx.rt.GedcomxConstants;
@@ -39,11 +40,19 @@
3940
@JsonElementWrapper ( name = "notes" )
4041
@XmlType ( name = "Note", propOrder = {"subject", "text", "attribution"} )
4142
@JsonInclude ( JsonInclude.Include.NON_NULL )
43+
@Schema(description = "A note about a genealogical resource (e.g. conclusion or source).")
4244
public class Note extends HypermediaEnabledData implements Attributable, HasText {
4345

46+
@Schema(description = "The language of the note. See http://www.w3.org/International/articles/language-tags/")
4447
private String lang;
48+
49+
@Schema(description = "The subject of the note. This is a short title describing the contents of the note text.")
4550
private String subject;
51+
52+
@Schema(description = "The text of the note.")
4653
private String text;
54+
55+
@Schema(description = "Attribution metadata for a note.")
4756
private Attribution attribution;
4857

4958
public Note() {

gedcomx-model/src/main/java/org/gedcomx/common/Qualifier.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.gedcomx.rt.ControlledVocabulary;
2424
import org.gedcomx.rt.json.JsonElementWrapper;
2525

26+
import io.swagger.v3.oas.annotations.media.Schema;
2627
import jakarta.xml.bind.annotation.XmlAttribute;
2728
import jakarta.xml.bind.annotation.XmlRootElement;
2829
import jakarta.xml.bind.annotation.XmlTransient;
@@ -38,9 +39,13 @@
3839
@JsonElementWrapper(name = "qualifiers")
3940
@XmlType( name = "Qualifier" )
4041
@JsonInclude ( JsonInclude.Include.NON_NULL )
42+
@Schema(description = "A data qualifier. Qualifiers are used to \"qualify\" certain data elements to provide additional context, information, or details.")
4143
public final class Qualifier {
4244

45+
@Schema(description = "The name of the qualifier. The name should be an element of a constrained vocabulary and is used to determine meaning of the qualifier.")
4346
private URI name;
47+
48+
@Schema(description = "The value of the qualifier. Some qualifiers may not have values, indicating that the qualifier is to be treated more like a \"tag\".")
4449
private String value;
4550

4651
public Qualifier() {

gedcomx-model/src/main/java/org/gedcomx/common/ResourceReference.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.fasterxml.jackson.annotation.JsonInclude;
1919
import com.webcohesion.enunciate.metadata.Facet;
2020
import com.webcohesion.enunciate.metadata.Facets;
21+
import io.swagger.v3.oas.annotations.media.Schema;
2122
import org.gedcomx.rt.GedcomxConstants;
2223
import org.gedcomx.rt.json.JsonElementWrapper;
2324

@@ -36,9 +37,13 @@
3637
@XmlType ( name = "ResourceReference" )
3738
@JsonElementWrapper ( name = "resourceReference" )
3839
@JsonInclude ( JsonInclude.Include.NON_NULL )
40+
@Schema(description = "A generic reference to a resource.")
3941
public final class ResourceReference {
4042

43+
@Schema(description = "The URI to the resource. For more information, see Architecture of the World Wide Web, Volume One, Section 2")
4144
private URI resource;
45+
46+
@Schema(description = "The resource id of the resource being referenced. Used as an extension attribute when resolving the resource is inconvenient.")
4247
private String resourceId;
4348

4449
public ResourceReference() {

0 commit comments

Comments
 (0)