-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend new oneOf validation messages to OCDS 1.0 files
- Loading branch information
Showing
6 changed files
with
1,459 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
tests/lib/fixtures/common/1-0/record-package-schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
{ | ||
"id": "http://standard.open-contracting.org/schema/1__0__3/record-package-schema.json", | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "Schema for an Open Contracting Record package", | ||
"description": "The record package contains a list of records along with some publishing meta data. The records pull together all the releases under a single Open Contracting ID and compile them into the latest version of the information along with the history of any data changes.", | ||
"type": "object", | ||
"properties": { | ||
"uri": { | ||
"title": "Package Identifier", | ||
"description": "The URI of this package that identifies it uniquely in the world.", | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"publisher": { | ||
"description": "Information to uniquely identify the publisher of this package.", | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"title":"Name", | ||
"description":"The name of the organisation or department responsible for publishing this data.", | ||
"type": "string" | ||
}, | ||
"scheme": { | ||
"title":"Scheme", | ||
"description": "The scheme that holds the unique identifiers used to identify the item being identified.", | ||
"type": ["string", "null"] | ||
}, | ||
"uid": { | ||
"title":"uid", | ||
"description": "The unique ID for this entity under the given ID scheme. Note the use of 'uid' rather than 'id'. See issue #245.", | ||
"type": ["string", "null"] | ||
}, | ||
"uri": { | ||
"title":"URI", | ||
"description":"A URI to identify the publisher.", | ||
"type": ["string", "null"], | ||
"format" : "uri" | ||
} | ||
}, | ||
"required": ["name"] | ||
}, | ||
"license": { | ||
"description": "A link to the license that applies to the data in this datapackage. [Open Definition Conformant](http://opendefinition.org/licenses/) licenses are strongly recommended. The canonical URI of the license should be used. Documents linked from this file may be under other license conditions. ", | ||
"type": ["string", "null"], | ||
"format": "uri" | ||
}, | ||
"publicationPolicy": { | ||
"description": "A link to a document describing the publishers publication policy.", | ||
"type": ["string", "null"], | ||
"format": "uri" | ||
}, | ||
"publishedDate": { | ||
"description": "The date that this package was published.", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"packages": { | ||
"description": "A list of URIs of all the release packages that were used to create this record package.", | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"uniqueItems": true | ||
}, | ||
"records": { | ||
"description": "The records for this data package.", | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { "$ref": "#/definitions/record" }, | ||
"uniqueItems": true | ||
} | ||
}, | ||
"required": ["uri", "publisher", "publishedDate", "packages", "records"], | ||
"definitions": { | ||
"record": { | ||
"type": "object", | ||
"properties": { | ||
"ocid": { | ||
"title": "Open Contracting ID", | ||
"description": "A unique identifier that identifies the unique Open Contracting Process. For more information see: http://standard.open-contracting.org/1.0/en/getting_started/contracting_process/", | ||
"type": "string" | ||
}, | ||
"releases": { | ||
"description": "An array of linking identifiers or releases", | ||
"oneOf": [ | ||
{ | ||
"title": "Linked releases", | ||
"description": "A list of objects that identify the releases associated with this Open Contracting ID. The releases MUST be sorted into date order in the array, from oldest (at position 0) to newest (last).", | ||
"type": "array", | ||
"items": { | ||
"description": "Information to uniquely identify the release.", | ||
"type": "object", | ||
"properties": { | ||
"url": { | ||
"description": "The url of the release which contains the url of the package with the releaseID appended using a fragment identifier e.g. http://standard.open-contracting.org/1.0/en/examples/tender.json#ocds-213czf-000-00001", | ||
"type": ["string", "null"], | ||
"format" : "uri" | ||
}, | ||
"date": { | ||
"title": "Release Date", | ||
"description": "The date of the release, should match `date` at the root level of the release. This is used to sort the releases in the list into date order.", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"tag": { | ||
"title": "Release Tag", | ||
"description": "The tag should match the tag in the release. This provides additional context when reviewing a record to see what types of releases are included for this ocid.", | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"enum": ["planning", "tender", "tenderAmendment", "tenderUpdate", "tenderCancellation", "award", "awardUpdate", "awardCancellation", "contract", "contractUpdate", "contractAmendment", "implementation", "implementationUpdate", "contractTermination", "compiled"] | ||
} | ||
} | ||
}, | ||
"required": ["url", "date"] | ||
}, | ||
"minItems": 1 | ||
}, | ||
{ | ||
"title": "Embedded releases", | ||
"description": "A list of releases, with all the data. The releases MUST be sorted into date order in the array, from oldest (at position 0) to newest (last).", | ||
"type": "array", | ||
"items": { | ||
"$ref": "http://standard.open-contracting.org/schema/1__0__3/release-schema.json" | ||
}, | ||
"minItems": 1 | ||
} | ||
] | ||
}, | ||
"compiledRelease": { | ||
"title": "Compiled release", | ||
"description": "This is the latest version of all the contracting data, it has the same schema as an open contracting release.", | ||
"$ref": "http://standard.open-contracting.org/schema/1__0__3/release-schema.json" | ||
}, | ||
"versionedRelease": { | ||
"title": "Versioned release", | ||
"description": "This contains the history of the data in the compiledRecord. With all versions of the information and the release they came from.", | ||
"$ref": "http://standard.open-contracting.org/schema/1__0__3/versioned-release-validation-schema.json" | ||
} | ||
}, | ||
"required": ["ocid", "releases"] | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
tests/lib/fixtures/common/1-0/records_invalid_releases.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"uri": "http://example.org/invalid_record.json", | ||
"publishedDate": "2019-09-18T17:56:21.078Z", | ||
"publisher": { | ||
"name": "A Publisher Name" | ||
}, | ||
"packages": ["http://example.org/release_package.json"], | ||
"records": [ | ||
{ | ||
"ocid": "EXAMPLE-0", | ||
"releases": [] | ||
}, | ||
{ | ||
"ocid": "EXAMPLE-1", | ||
"releases": [ | ||
{} | ||
] | ||
}, | ||
{ | ||
"ocid": "EXAMPLE-2", | ||
"releases": [ | ||
{"id": "EXAMPLE-2-1"} | ||
] | ||
}, | ||
{ | ||
"ocid": "EXAMPLE-3", | ||
"releases": [ | ||
{"url": "http://example.org/releases.json#EXAMPLE-3-1"} | ||
] | ||
}, | ||
{ | ||
"ocid": "EXAMPLE-4", | ||
"releases": [ | ||
{"id": "EXAMPLE-4-1"}, | ||
{} | ||
] | ||
}, | ||
{ | ||
"ocid": "EXAMPLE-5", | ||
"releases": [ | ||
{"id": "EXAMPLE-5-1"}, | ||
{"url": "http://example.org/releases.json#EXAMPLE-5-2"} | ||
] | ||
}, | ||
{ | ||
"ocid": "EXAMPLE-97", | ||
"releases": "a string" | ||
}, | ||
{ | ||
"ocid": "EXAMPLE-98", | ||
"releases": null | ||
}, | ||
{ | ||
"ocid": "EXAMPLE-99", | ||
"releases": {} | ||
} | ||
] | ||
} |
Oops, something went wrong.