Skip to content

Commit

Permalink
Merge pull request #15 from vasgat/schema-modularization
Browse files Browse the repository at this point in the history
Modularize SCDEX schema and enhance testing with new validation setup
  • Loading branch information
shuyag authored Nov 20, 2024
2 parents 4b803ba + 491f22e commit ffcb068
Show file tree
Hide file tree
Showing 14 changed files with 435 additions and 243 deletions.
84 changes: 84 additions & 0 deletions examples/full/valid/extension-schema-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"$schema": "../../../schema/core-schema.json",
"locations": [
{
"guid": "82d39ac8-1a12-4801-835a-85d319927548",
"location-type": "factory",
"language": "en",
"products": [
"Accessories",
"Hats"
],
"processing-types": [
"Final Product Assembly",
"Cutting",
"Embroidery",
"Finishing",
"Ironing",
"Knitting"
],
"location-identifier": "osid:CN2021250D1DTN7",
"name": "Huai An Yuan Tong Headwear Mfg. Co., Ltd.",
"coordinates": {
"latitude": 33.7862099,
"longitude": 119.2787399
},
"address": {
"street-name": "Yan Huang Avenue",
"building-number": "No.30 & 32 & 99",
"town-name": "Huaian",
"country-sub-division": "Jiangsu",
"country": "CN",
"address-line": [
"No.30 & 32 & 99 Yan Huang Avenue",
"Lian Shui Economic Developmental District",
"Huaian, Jiangsu - China"
]
},
"responsible-recruiting": {
"recruitment-fee": 200,
"employer-coverage": 150,
"initial-contact-date": "2024-01-15",
"contract-signing-date": "2024-02-01",
"first-paycheck-date": "2024-03-01"
}
}
],
"organizations": [
{
"guid": "91582fdd-6f72-47cf-a113-f68fe4e74865",
"organization-type": "retailer",
"language": "en",
"organizational-identifier": "lei:3538002LJMRZ83SU0B85"
},
{
"guid": "91582fdd-6f72-47cf-a113-f68fe4e74866",
"organization-type": "retailer",
"language": "en",
"organizational-identifier": "lei:353800ZCXKHDPY0N5218"
},
{
"guid": "91582fdd-6f72-47cf-a113-f68fe4e74867",
"organization-type": "retailer",
"language": "en",
"organizational-identifier": "lei:549300D9GZ4BMLDW5T40"
}
],
"affiliations": [
{
"from-guid": "82d39ac8-1a12-4801-835a-85d319927548",
"to-guid": "91582fdd-6f72-47cf-a113-f68fe4e74865",
"affiliation-type": "is supplier of"
},
{
"from-guid": "82d39ac8-1a12-4801-835a-85d319927548",
"to-guid": "91582fdd-6f72-47cf-a113-f68fe4e74866",
"affiliation-type": "is supplier of"
},
{
"from-guid": "82d39ac8-1a12-4801-835a-85d319927548",
"to-guid": "91582fdd-6f72-47cf-a113-f68fe4e74867",
"affiliation-type": "is supplier of"
}
]
}
27 changes: 27 additions & 0 deletions schema/components/affiliation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Affiliation Schema",
"type": "object",
"properties": {
"from-guid": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the source entity"
},
"to-guid": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the target entity"
},
"affiliation-type": {
"type": "string",
"description": "Type of relationship between the entities"
}
},
"required": [
"from-guid",
"to-guid",
"affiliation-type"
],
"additionalProperties": true
}
94 changes: 94 additions & 0 deletions schema/components/location.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Location Schema",
"type": "object",
"properties": {
"guid": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the location data"
},
"language": {
"$ref":"../definitions/language.json"
},
"location-type": {
"type": "string",
"description": "Type of location (e.g., factory, warehouse, farm)"
},
"location-identifier": {
"description": "Accepted location identifier, which can be a single string (e.g., 'osid:XXXXXXXX', 'gfid:XXXXXXXX') or an array of such strings (osid stands for open supply hub ID, and gfid for Global Field ID)",
"anyOf": [
{
"$ref": "../definitions/location-identifier"
},
{
"type": "array",
"items": {
"$ref": "../definitions/location-identifier"
},
"minItems": 1,
"description": "An array of location identifier strings"
}
]
},
"coordinates": {
"type": "object",
"description": "Geographic coordinates with latitude and longitude in ISO 6709 format",
"properties": {
"latitude": {
"type": "number",
"description": "Latitude of the location, ranging from -90 to 90",
"minimum": -90,
"maximum": 90
},
"longitude": {
"type": "number",
"description": "Longitude of the location, ranging from -180 to 180",
"minimum": -180,
"maximum": 180
}
},
"required": [
"latitude",
"longitude"
]
},
"name": {
"type": "string",
"description": "Name of the location, if available"
},
"address": {
"$ref": "../definitions/address.json"
},
"country": {
"type": "string",
"description": "Country code in ISO 3166 Alpha-2 or Alpha-3 format",
"pattern": "^[A-Z]{2,3}$"
},
"processing-types": {
"type": "array",
"items": {
"type": "string"
},
"description": "Processing activities conducted at the location"
},
"products": {
"type": "array",
"items": {
"type": "string"
},
"description": "Products produced at the location"
}
},
"allOf": [
{
"$ref": "../extensions/location-extensions.json"
}
],
"required": [
"guid",
"location-type",
"location-identifier"
],
"additionalProperties": true
}
48 changes: 48 additions & 0 deletions schema/components/organization.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Organization Schema",
"type": "object",
"properties": {
"guid": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the organization"
},
"language": {
"$ref": "../definitions/language.json"
},
"organization-type": {
"type": "string",
"description": "Type of organization (e.g., supplier, retailer)"
},
"name": {
"type": "string",
"description": "Name of the organization, if available"
},
"address": {
"$ref":"../definitions/address.json"
},
"organizational-identifier": {
"description": "Accepted organizational identifier (e.g., LEI, GLN, CRN)",
"anyOf": [
{
"$ref": "../definitions/organization-identifier"
},
{
"type": "array",
"items": {
"$ref": "../definitions/organization-identifier"
},
"minItems": 1,
"description": "An array of organization identifier strings"
}
]
}
},
"required": [
"guid",
"organization-type",
"organizational-identifier"
],
"additionalProperties": true
}
Loading

0 comments on commit ffcb068

Please sign in to comment.