diff --git a/schema/2.0/modules/cyclonedx-certification-2.0.schema.json b/schema/2.0/modules/cyclonedx-certification-2.0.schema.json index 19e0adc4f..afe33a49f 100644 --- a/schema/2.0/modules/cyclonedx-certification-2.0.schema.json +++ b/schema/2.0/modules/cyclonedx-certification-2.0.schema.json @@ -59,10 +59,17 @@ "description": "Description of the activities, facilities, products, services, or operations covered by the certification." }, "jurisdiction": { - "type": "string", "title": "Jurisdiction", "description": "ISO 3166-1 alpha-2 country code, ISO 3166-2 subdivision, or supranational identifier such as `\"EU\"`, where the certification applies.", - "examples": [ "US", "EU", "GB", "AU", "US-CA" ] + "anyOf": [ + { "$ref": "cyclonedx-common-2.0.schema.json#/$defs/countryOrSubdivision" }, + { + "type": "string", + "title": "Supranational identifier", + "minLength": 1, + "examples": [ "EU" ] + } + ] }, "level": { "type": "string", diff --git a/schema/2.0/modules/cyclonedx-common-2.0.schema.json b/schema/2.0/modules/cyclonedx-common-2.0.schema.json index 7c4ae381f..7d17a7ad4 100644 --- a/schema/2.0/modules/cyclonedx-common-2.0.schema.json +++ b/schema/2.0/modules/cyclonedx-common-2.0.schema.json @@ -327,9 +327,17 @@ "$ref": "#/$defs/refIdType" }, "country": { - "type": "string", "title": "Country", - "description": "The country name or the two-letter ISO 3166-1 country code." + "description": "The country name or the two-letter ISO 3166-1 alpha-2 country code.", + "anyOf": [ + { + "title": "Country name", + "type": "string", + "minLength": 1, + "examples": [ "Germany" ] + }, + { "$ref": "#/$defs/ISO_3166/$defs/alpha-2" } + ] }, "region": { "type": "string", @@ -549,11 +557,9 @@ "required": [ "isoCode", "percentage" ], "properties": { "isoCode": { - "type": "string", "title": "ISO Code", "description": "The country or subdivision of origin, expressed as an ISO 3166-1 alpha-2 country code (for example, `\"CA\"` for Canada) or an ISO 3166-2 subdivision code (for example, `\"US-CA\"` for California, United States).", - "pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$", - "examples": [ "CA", "US-CA" ] + "$ref": "#/$defs/countryOrSubdivision" }, "value": { "type": "number", @@ -1408,6 +1414,46 @@ } } } + }, + "countryOrSubdivision": { + "title": "Country code or subdivision per ISO 3166", + "description": "Country or subdivision, expressed as an ISO 3166-1 alpha-2 country code (for example, `\"CA\"` for Canada) or an ISO 3166-2 subdivision code (for example, `\"US-CA\"` for California, United States).", + "examples": [ "CA", "US-CA" ], + "anyOf": [ + { "$ref": "#/$defs/ISO_3166/$defs/alpha-2" }, + { "$ref": "#/$defs/ISO_3166/$defs/subdivision" } + ] + }, + "ISO_3166": { + "title": "ISO 3166", + "description": "Internal helpers. Not part of the public schema API — do not reference externally; may change without notice.", + "not": { "$comment": "This schema provides definitions only and is not intended for direct validation or instantiation." }, + "$defs": { + "alpha-3": { + "title": "ISO 3166-1 alpha-2 country code", + "description": "ISO 3166-1 alpha-3 country code (for example, `\"CHE\"` for Switzerland)", + "$comment": "The pattern validates only the syntactic format of the code. It does not verify whether the value is an officially assigned ISO 3166-1 alpha-2 code. Implementations are responsible for validating values against the applicable ISO 3166-1 code list.", + "type": "string", + "pattern": "^[A-Z]{3}$", + "examples": [ "CHE", "AUS", "AUT" ] + }, + "alpha-2": { + "title": "ISO 3166-1 alpha-2 country code", + "description": "ISO 3166-1 alpha-2 country code (for example, `\"CA\"` for Canada)", + "$comment": "The pattern validates only the syntactic format of the code. It does not verify whether the value is an officially assigned ISO 3166-1 alpha-2 code. Implementations are responsible for validating values against the applicable ISO 3166-1 code list.", + "type": "string", + "pattern": "^[A-Z]{2}$", + "examples": [ "CA", "DE", "US" ] + }, + "subdivision": { + "title": " ISO 3166-2 subdivision code", + "description": "ISO 3166-2 subdivision code (for example, `\"US-CA\"` for California, United States).", + "$comment": "The pattern validates only the syntactic format of the code. It does not verify whether the value is an officially assigned ISO 3166-2 subdivision code. Implementations are responsible for validating values against the applicable ISO 3166-2 code list.", + "type": "string", + "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$", + "examples": [ "US-CA", "DE-BY" ] + } + } } } } diff --git a/schema/2.0/modules/cyclonedx-data-2.0.schema.json b/schema/2.0/modules/cyclonedx-data-2.0.schema.json index e2ab80f49..8d3fe07b9 100644 --- a/schema/2.0/modules/cyclonedx-data-2.0.schema.json +++ b/schema/2.0/modules/cyclonedx-data-2.0.schema.json @@ -690,21 +690,17 @@ "description": "The geographic or political jurisdictions whose laws and regulations apply. Values should use ISO 3166-1 alpha-2 country codes or ISO 3166-2 subdivision codes for subnational jurisdictions.", "uniqueItems": true, "items": { - "type": "string", - "minLength": 2, - "examples": [ - "US", - "GB", - "US-CA" - ] - }, - "examples": [ - [ - "US", - "GB", - "DE" + "anyOf": [ + { "$ref": "cyclonedx-common-2.0.schema.json#/$defs/countryOrSubdivision" }, + { + "title": "Free text", + "description": "Values like supranational identifier.", + "type": "string", + "minLength": 2, + "examples": [ "EU" ] + } ] - ] + } }, "regulations": { "type": "array", diff --git a/schema/2.0/modules/cyclonedx-party-2.0.schema.json b/schema/2.0/modules/cyclonedx-party-2.0.schema.json index f35df3f5a..912de97e0 100644 --- a/schema/2.0/modules/cyclonedx-party-2.0.schema.json +++ b/schema/2.0/modules/cyclonedx-party-2.0.schema.json @@ -337,10 +337,13 @@ "description": "The date the organization was dissolved or wound down. When present, the organization is no longer active." }, "jurisdiction": { - "type": "string", "title": "Jurisdiction", - "description": "Country of registration as an ISO 3166-1 alpha-2 or alpha-3 code, optionally followed by an ISO 3166-2 subdivision separated by a hyphen.", - "examples": [ "US-DE", "IT-BO", "CHE" ] + "description": "Country of registration as an ISO 3166-1 alpha-3, or an ISO 3166-1 alpha-2 code optionally followed by an ISO 3166-2 subdivision separated by a hyphen.", + "anyOf": [ + { "$ref": "cyclonedx-common-2.0.schema.json#/$defs/ISO_3166/$defs/alpha-3" }, + { "$ref": "cyclonedx-common-2.0.schema.json#/$defs/ISO_3166/$defs/alpha-2" }, + { "$ref": "cyclonedx-common-2.0.schema.json#/$defs/ISO_3166/$defs/subdivision" } + ] }, "identifiers": { "type": "array", @@ -883,9 +886,17 @@ "description": "An identifier that can be used to reference the address from elsewhere. Every `refId` shall be unique within the containing instance." }, "country": { - "type": "string", "title": "Country", - "description": "The country name or the two-letter ISO 3166-1 country code. When the `isoCode` property is present, the value of `isoCode` is authoritative." + "description": "The country name or the two-letter ISO 3166-1 alpha-2 country code. When the `isoCode` property is present, the value of `isoCode` is authoritative.", + "anyOf": [ + { + "title": "Country name", + "type": "string", + "minLength": 1, + "examples": [ "Germany" ] + }, + { "$ref": "cyclonedx-common-2.0.schema.json#/$defs/ISO_3166/$defs/alpha-2" } + ] }, "region": { "type": "string", @@ -894,11 +905,9 @@ "examples": [ "Texas" ] }, "isoCode": { - "type": "string", - "pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$", "title": "ISO Code", "description": "An ISO 3166-1 alpha-2 country code, optionally followed by an ISO 3166-2 subdivision code separated by a hyphen. When present, this property is authoritative over the free-text country and region properties.", - "examples": [ "IT-BO", "US-CA", "DE-BY" ] + "$ref": "cyclonedx-common-2.0.schema.json#/$defs/countryOrSubdivision" }, "locality": { "type": "string",