Skip to content

Commit

Permalink
Update json-schema.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
Geary-Layne authored Aug 9, 2023
1 parent 1220669 commit d90669c
Showing 1 changed file with 68 additions and 61 deletions.
129 changes: 68 additions & 61 deletions docs/json-schema.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,82 +22,89 @@ Convention/Patterns:
- Auxiliary or Subschema are used to group related objects. Subschema objects are defined at the root
level in json files. The filename is based on the dominant object.

Timing.json::
{
"TimeString": {
"description": "String representation of a date/time",
"type": "string",
"format": "date-time"
},
"TimeList": {
"description": "A list of specific time_string(s)",
"type": "array",
"items": {"$ref": "#/TimeString"},
"minItems": 1
},
"TimeRange": {
"description": "Date/time string specifying the start and end date/ times",
"type": "object",
"properties": {
"start": {"$ref": "#/TimeString"},
"end": {"$ref": "#/TimeString"}
},
"required": [
"start",
"end"
]
},
"Timing": {
"description": "Either a TimeString, TimeList, or TimeRange",
"oneOf": [
{"$ref": "#/TimeString"},
{"$ref": "#/TimeList"},
{"$ref": "#/TimeRange"}
]
}
}
**Timing.json**::

{
"TimeString": {
"description": "String representation of a date/time",
"type": "string",
"format": "date-time"
},
"TimeList": {
"description": "A list of specific time_string(s)",
"type": "array",
"items": {"$ref": "#/TimeString"},
"minItems": 1
},
"TimeRange": {
"description": "Date/time string specifying the start and end date/ times",
"type": "object",
"properties": {
"start": {"$ref": "#/TimeString"},
"end": {"$ref": "#/TimeString"}
},
"required": [
"start",
"end"
]
},
"Timing": {
"description": "Either a TimeString, TimeList, or TimeRange",
"oneOf": [
{"$ref": "#/TimeString"},
{"$ref": "#/TimeList"},
{"$ref": "#/TimeRange"}
]
}
}



- Schemas that define a message should, for the most part, be entirely built from subschema. The
filename should represent the message type and end with _schema in order to distinguish from
subschema.

*(These examples are not complete, thus will need to be updated)*
.. note:: *These examples are not complete, thus will need to be updated*


New_data_schema.json *(this currently is only a partial schema, new data service publishes other information)*
**New_data_schema.json**

*(This currently is only a partial schema, new data service publishes other information)*

One of the messages that the new_data service publishes indicates when a field from a product source
is available for a specific issue/valid datetime. Basically this is a message specifying the Variable
subschema, except that a Variable does NOT require a Field *(it is optional)*. Thus the new_data message
utilized the Variable subschema and adds the additional requirement that there must be at least one
field.::

{
"type": "object",
"allOf": [
{"$ref": "variable.json#/Variable"},
{"properties": {"field": {"minItems": 1}}}
]
}
{
"type": "object",
"allOf": [
{"$ref": "variable.json#/Variable"},
{"properties": {"field": {"minItems": 1}}}
]
}


**Criteria_schema.json**

Criteria_schema.json *(this is incomplete, there is more in a criteria message, but is a
*(This is incomplete, there is more in a criteria message, but is a
good example of how a message is built from subschemas)*::

{
"type": "object",
"properties": {
"corrId": {"$ref": "corr_id.json#/CorrId"},
"issueDt": {"$ref": "timing.json#/Timing"},
"tags": {"$ref": "tags.json#/Tags"},
"validDt": {"$ref": "timing.json#/Timing"},
"location": {"$ref": "location.json#/Location"}
},
"required": [
"corrId",
"issueDt",
"tags",
"validDt",
"location"
]
}
{
"type": "object",
"properties": {
"corrId": {"$ref": "corr_id.json#/CorrId"},
"issueDt": {"$ref": "timing.json#/Timing"},
"tags": {"$ref": "tags.json#/Tags"},
"validDt": {"$ref": "timing.json#/Timing"},
"location": {"$ref": "location.json#/Location"}
},
"required": [
"corrId",
"issueDt",
"tags",
"validDt",
"location"
]
}

0 comments on commit d90669c

Please sign in to comment.