diff --git a/examples/example_mapping.xomm b/examples/example_mapping.xomm index 6339e63c..8ce4ae4e 100644 --- a/examples/example_mapping.xomm +++ b/examples/example_mapping.xomm @@ -8,7 +8,7 @@ "copyright": "(C) 2023-2024, Example Company", "license": "MPL-2.0", "author": "john.doe@asam.net", - "creationDate": "20240703T101728Z", + "creationDate": "20240703T101728Z" }, "materialMapping": [ ["Material_Sphere", "example_material.xomp", "white aluminum"], diff --git a/schemas/asset_schema.json b/schemas/asset_schema.json index e078b48e..566477af 100644 --- a/schemas/asset_schema.json +++ b/schemas/asset_schema.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", - "description": "ASAM OpenMATERIAL Asset file definition.", + "description": "ASAM OpenMATERIAL 3D Geometry Asset file definition.", "properties": { "metadata": { "type": "object", @@ -27,7 +27,7 @@ }, "openMaterialVersion": { "type": "string", - "description": "The version of the OpenMATERIAL specification used, adhering to semantic versioning (e.g., '1.0.0').", + "description": "The version of the OpenMATERIAL 3D specification used, adhering to semantic versioning (e.g., '1.0.0').", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, "copyright": { @@ -48,7 +48,7 @@ }, "creationDate": { "type": "string", - "description": "The date and time of asset creation, formatted in ISO 8601 (e.g., '20240703T101728Z').", + "description": "The date and time of asset creation, formatted as YYYYMMDDTHHMMSSZ according to ISO 8601 (e.g., '20240703T101728Z').", "pattern": "^\\d{8}T\\d{6}Z$" }, "modelingMethod": { @@ -83,7 +83,7 @@ }, "pbrMaterialWorkflow": { "type": "string", - "description": "Indicates the usage of a Physically Based Rendering (PBR) material workflow as 'metallic', 'specular' or 'none'. This only applies to the internal materials of the 3D model file, not to mapped OpenMATERIAL property files.", + "description": "Indicates the usage of a Physically Based Rendering (PBR) material workflow as 'metallic', 'specular' or 'none'. This only applies to the internal materials of the 3D model file, not to mapped OpenMATERIAL 3D property files.", "enum": [ "metallic", "specular", @@ -162,14 +162,12 @@ }, "required": [ "name", - "description", "uuid", "assetVersion", "openMaterialVersion", "copyright", "license", "author", - "creationDate", "assetType", "objectClass", "animated", @@ -183,12 +181,12 @@ }, "materialMappingUri": { "type": "string", - "description": "Relative path to a material mapping file (.xomm). In this file, material names from the 3D model file or texture color codes from textures assigned in materialTextureAssignment are linked to OpenMATERIAL property files.", + "description": "Relative path to a material mapping file (.xomm). In this file, material names from the 3D model file or texture color codes from textures assigned in materialTextureAssignment are linked to OpenMATERIAL 3D property files.", "pattern": ".*\\.xomm$" }, "materialTextureAssignment": { "type": "array", - "description": "Optional array containing material texture assignments. It links material names contained in the 3D model file to OpenMATERIAL assignment textures. In a separate material mapping file, the 'color' values in this texture are linked to OpenMATERIAL property files.", + "description": "Optional array containing material texture assignments. It links material names contained in the 3D model file to OpenMATERIAL 3D assignment textures. In a separate material mapping file, the 'color' values in this texture are linked to OpenMATERIAL 3D property files.", "items": { "type": "array", "items": [ @@ -198,7 +196,7 @@ }, { "type": "string", - "description": "File path to the OpenMATERIAL assignment texture. Supported texture formats are png and jpg.", + "description": "File path to the OpenMATERIAL 3D assignment texture. Supported texture formats are png and jpg.", "pattern": "^(\\./|/)?([a-zA-Z0-9_\\-./]+)\\.(png|jpg|jpeg)$" } ], diff --git a/schemas/mapping_schema.json b/schemas/mapping_schema.json index ed1dc384..970b88ed 100644 --- a/schemas/mapping_schema.json +++ b/schemas/mapping_schema.json @@ -1,49 +1,50 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Material Mapping Schema", "type": "object", + "description": "ASAM OpenMATERIAL 3D Geometry Asset file definition.", "properties": { "metadata": { "type": "object", + "description": "The key meta information about the mapping table, including its identity, authorship, technical specifications, and legal details.", "properties": { "name": { "type": "string", - "description": "Name of the material mapping." + "description": "The display name of the material mapping table." }, "description": { "type": "string", - "description": "This is a short description of the material mapping table. Use 2-3 sentences." + "description": "Short description of the mapping table in 2 - 3 sentences." }, "uuid": { "type": "string", - "description": "Universally unique identifier for the material mapping in 8-4-4-4-12 format, see https://en.wikipedia.org/wiki/Universally_unique_identifier. The uuid stays the same, even if version is updated.", + "description": "Universally unique identifier for the mapping table in 8-4-4-4-12 format, see https://en.wikipedia.org/wiki/Universally_unique_identifier. The uuid stays the same, even if version is updated.", "pattern": "\\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\b$" }, "mappingVersion": { "type": "string", - "description": "Version of the mapping table.", + "description": "The version number of the mapping table, following semantic versioning (e.g., '1.0.0').", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, "openMaterialVersion": { "type": "string", - "description": "Version of the OpenMaterial format.", + "description": "The version of the OpenMATERIAL 3D specification used, adhering to semantic versioning (e.g., '1.0.0').", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, "copyright": { "type": "string", - "description": "Copyright information with year and company." + "description": "Indicates copyright details, including the year and copyright holder (e.g., '© 2024 ACME Inc.')." }, "license": { "type": "string", - "description": "License information. For common open source licenses, provide an SPDX identifier or a URL to the license." + "description": "Describes the license for asset distribution. Use an SPDX identifier for open-source licenses (e.g., 'MIT'), or provide a URL or filename for proprietary licenses." }, "author": { "type": "string", - "description": "Email address or name of the author. Can also be a company name." + "description": "Lists the author(s) of the asset as a name, email, or company. Multiple authors should be comma-separated." }, "creationDate": { "type": "string", - "description": "Date and time when the material mapping was created in ISO 8601 format.", + "description": "The date and time of asset creation, formatted as YYYYMMDDTHHMMSSZ according to ISO 8601 (e.g., '20240703T101728Z').", "pattern": "^\\d{8}T\\d{6}Z$" } }, @@ -52,7 +53,9 @@ "uuid", "mappingVersion", "openMaterialVersion", - "creationDate" + "copyright", + "license", + "author" ] }, "materialMapping": { @@ -63,7 +66,7 @@ "items": [ { "type": "string", - "description": "Material name or RGB code. The RGB code represents color values in an OpenMATERIAL assignment texture." + "description": "Material name or RGB code. The RGB code represents color values in an OpenMATERIAL 3D assignment texture." }, { "type": "string", diff --git a/schemas/material_brdf_schema.json b/schemas/material_brdf_schema.json index fccf708d..a2e3805b 100644 --- a/schemas/material_brdf_schema.json +++ b/schemas/material_brdf_schema.json @@ -1,14 +1,15 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", + "description": "ASAM OpenMATERIAL 3D Material BRDF look-up table file definition.", "properties": { "metadata": { "type": "object", - "description": "Metadata about the material.", + "description": "The key meta information about the BRDF look-up table.", "properties": { "name": { "type": "string", - "description": "Name of the material." + "description": "The display name of the material, such as 'Red brick' or 'Dark asphalt'." }, "description": { "type": "string", @@ -21,42 +22,40 @@ }, "materialVersion": { "type": "string", - "description": "Version of the material.", + "description": "The version number of the material, following semantic versioning (e.g., '1.0.0').", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, - "creationDate": { - "type": "string", - "description": "Creation date of the material in the format YYYYMMDDTHHMMSSZ.", - "pattern": "^\\d{8}T\\d{6}Z$" - }, "openMaterialVersion": { "type": "string", - "description": "Version of OpenMATERIAL.", + "description": "The version of the OpenMATERIAL 3D specification used, adhering to semantic versioning (e.g., '1.0.0').", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, "copyright": { "type": "string", - "description": "Copyright information with year and company." + "description": "Indicates copyright details, including the year and copyright holder (e.g., '© 2024 ACME Inc.')." }, "license": { "type": "string", - "description": "License information. For common open source licenses, provide an SPDX identifier. For other types of licenses, provide an URL to a webpage with the license or the filename of a separately provided license file." + "description": "Describes the license for asset distribution. Use an SPDX identifier for open-source licenses (e.g., 'MIT'), or provide a URL or filename for proprietary licenses." }, "author": { "type": "string", - "description": "Name or email address of the author of this material. In case of multiple authors, use comma-separation. The author can also be a company name." + "description": "Lists the author(s) of the asset as a name, email, or company. Multiple authors should be comma-separated." + }, + "creationDate": { + "type": "string", + "description": "The date and time of asset creation, formatted as YYYYMMDDTHHMMSSZ according to ISO 8601 (e.g., '20240703T101728Z').", + "pattern": "^\\d{8}T\\d{6}Z$" }, "source": { "type": "string", - "description": "Source of the brdf data." + "description": "Source of the BRDF data. Was is measured, simulated, or taken from literature?" } }, "required": [ "name", - "description", "uuid", "materialVersion", - "creationDate", "openMaterialVersion", "copyright", "license", diff --git a/schemas/material_emp_schema.json b/schemas/material_emp_schema.json index 79de600c..0a9f596d 100644 --- a/schemas/material_emp_schema.json +++ b/schemas/material_emp_schema.json @@ -1,14 +1,15 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", + "description": "ASAM OpenMATERIAL 3D Material electro-magnetic properties look-up table file definition.", "properties": { "metadata": { "type": "object", - "description": "Metadata about the material.", + "description": "The key meta information about the EMP look-up table.", "properties": { "name": { "type": "string", - "description": "Name of the material." + "description": "The display name of the material, such as 'Red brick' or 'Dark asphalt'." }, "description": { "type": "string", @@ -21,42 +22,40 @@ }, "materialVersion": { "type": "string", - "description": "Version of the material.", + "description": "The version number of the material, following semantic versioning (e.g., '1.0.0').", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, - "creationDate": { - "type": "string", - "description": "Creation date of the material in the format YYYYMMDDTHHMMSSZ.", - "pattern": "^\\d{8}T\\d{6}Z$" - }, "openMaterialVersion": { "type": "string", - "description": "Version of OpenMATERIAL.", + "description": "The version of the OpenMATERIAL 3D specification used, adhering to semantic versioning (e.g., '1.0.0').", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, "copyright": { "type": "string", - "description": "Copyright information with year and company." + "description": "Indicates copyright details, including the year and copyright holder (e.g., '© 2024 ACME Inc.')." }, "license": { "type": "string", - "description": "License information. For common open source licenses, provide an SPDX identifier. For other types of licenses, provide an URL to a webpage with the license or the filename of a separately provided license file." + "description": "Describes the license for asset distribution. Use an SPDX identifier for open-source licenses (e.g., 'MIT'), or provide a URL or filename for proprietary licenses." }, "author": { "type": "string", - "description": "Name or email address of the author of this material. In case of multiple authors, use comma-separation. The author can also be a company name." + "description": "Lists the author(s) of the asset as a name, email, or company. Multiple authors should be comma-separated." + }, + "creationDate": { + "type": "string", + "description": "The date and time of asset creation, formatted as YYYYMMDDTHHMMSSZ according to ISO 8601 (e.g., '20240703T101728Z').", + "pattern": "^\\d{8}T\\d{6}Z$" }, "source": { "type": "string", - "description": "Source of the electromagnetic property data." + "description": "Source of the electro-magnetic property data. Was is measured, simulated, or taken from literature?" } }, "required": [ "name", - "description", "uuid", "materialVersion", - "creationDate", "openMaterialVersion", "copyright", "license", diff --git a/schemas/material_optical_schema.json b/schemas/material_optical_schema.json index ced5a208..210422eb 100644 --- a/schemas/material_optical_schema.json +++ b/schemas/material_optical_schema.json @@ -1,14 +1,15 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", + "description": "ASAM OpenMATERIAL 3D Material optical properties look-up table file definition.", "properties": { "metadata": { "type": "object", - "description": "Metadata about the material.", + "description": "The key meta information about the optical look-up table.", "properties": { "name": { "type": "string", - "description": "Name of the material." + "description": "The display name of the material, such as 'Red brick' or 'Dark asphalt'." }, "description": { "type": "string", @@ -21,42 +22,40 @@ }, "materialVersion": { "type": "string", - "description": "Version of the material.", + "description": "The version number of the material, following semantic versioning (e.g., '1.0.0').", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, - "creationDate": { - "type": "string", - "description": "Creation date of the material in the format YYYYMMDDTHHMMSSZ.", - "pattern": "^\\d{8}T\\d{6}Z$" - }, "openMaterialVersion": { "type": "string", - "description": "Version of OpenMATERIAL.", + "description": "The version of the OpenMATERIAL 3D specification used, adhering to semantic versioning (e.g., '1.0.0').", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, "copyright": { "type": "string", - "description": "Copyright information with year and company." + "description": "Indicates copyright details, including the year and copyright holder (e.g., '© 2024 ACME Inc.')." }, "license": { "type": "string", - "description": "License information. For common open source licenses, provide an SPDX identifier. For other types of licenses, provide an URL to a webpage with the license or the filename of a separately provided license file." + "description": "Describes the license for asset distribution. Use an SPDX identifier for open-source licenses (e.g., 'MIT'), or provide a URL or filename for proprietary licenses." }, "author": { "type": "string", - "description": "Name or email address of the author of this material. In case of multiple authors, use comma-separation. The author can also be a company name." + "description": "Lists the author(s) of the asset as a name, email, or company. Multiple authors should be comma-separated." + }, + "creationDate": { + "type": "string", + "description": "The date and time of asset creation, formatted as YYYYMMDDTHHMMSSZ according to ISO 8601 (e.g., '20240703T101728Z').", + "pattern": "^\\d{8}T\\d{6}Z$" }, "source": { "type": "string", - "description": "Source of the optical property data." + "description": "Source of the electro-magnetic property data. Was is measured, simulated, or taken from literature?" } }, "required": [ "name", - "description", "uuid", "materialVersion", - "creationDate", "openMaterialVersion", "copyright", "license", diff --git a/schemas/material_schema.json b/schemas/material_schema.json index e98fb2d6..cb75bcac 100644 --- a/schemas/material_schema.json +++ b/schemas/material_schema.json @@ -1,14 +1,15 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", + "description": "ASAM OpenMATERIAL 3D Material file definition.", "properties": { "metadata": { "type": "object", - "description": "Metadata about the material.", + "description": "The key meta information about the material properties.", "properties": { "name": { "type": "string", - "description": "Name of the material." + "description": "The display name of the material, such as 'Red brick' or 'Dark asphalt'." }, "description": { "type": "string", @@ -21,38 +22,36 @@ }, "materialVersion": { "type": "string", - "description": "Version of the material.", + "description": "The version number of the material, following semantic versioning (e.g., '1.0.0').", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, - "creationDate": { - "type": "string", - "description": "Creation date of the material in the format YYYYMMDDTHHMMSSZ.", - "pattern": "^\\d{8}T\\d{6}Z$" - }, "openMaterialVersion": { "type": "string", - "description": "Version of OpenMATERIAL.", + "description": "The version of the OpenMATERIAL 3D specification used, adhering to semantic versioning (e.g., '1.0.0').", "pattern": "^\\d+\\.\\d+\\.\\d+$" }, "copyright": { "type": "string", - "description": "Copyright information with year and company." + "description": "Indicates copyright details, including the year and copyright holder (e.g., '© 2024 ACME Inc.')." }, "license": { "type": "string", - "description": "License information. For common open source licenses, provide an SPDX identifier. For other types of licenses, provide an URL to a webpage with the license or the filename of a separately provided license file." + "description": "Describes the license for asset distribution. Use an SPDX identifier for open-source licenses (e.g., 'MIT'), or provide a URL or filename for proprietary licenses." }, "author": { "type": "string", - "description": "Name or email address of the author of this material. In case of multiple authors, use comma-separation. The author can also be a company name." + "description": "Lists the author(s) of the asset as a name, email, or company. Multiple authors should be comma-separated." + }, + "creationDate": { + "type": "string", + "description": "The date and time of asset creation, formatted as YYYYMMDDTHHMMSSZ according to ISO 8601 (e.g., '20240703T101728Z').", + "pattern": "^\\d{8}T\\d{6}Z$" } }, "required": [ "name", - "description", "uuid", "materialVersion", - "creationDate", "openMaterialVersion", "copyright", "license", @@ -164,7 +163,7 @@ } }, "required": [ - "coefficienOfRetroreflection", + "coefficientOfRetroreflection", "source" ] }, @@ -193,14 +192,7 @@ "type": "string" } } - }, - "required": [ - "surfaceRoughness", - "emissivityData", - "elasticityData", - "densityData", - "electromagneticPropertiesUri" - ] + } } }, "required": [ diff --git a/scripts/json2asciidoc.py b/scripts/json2asciidoc.py index 72c78642..d1106123 100644 --- a/scripts/json2asciidoc.py +++ b/scripts/json2asciidoc.py @@ -117,7 +117,7 @@ def generate_asciidoc_properties(properties: Dict, required_fields: List[str], l return asciidoc_content -def generate_asciidoc_main_field(field_name: str, schema: Dict, required_fields: List[str]) -> str: +def generate_asciidoc_main_field(field_name: str, schema: Dict, is_required: bool, required_fields: List[str]) -> str: """ Generate AsciiDoc content for the specified field based on the JSON schema. @@ -139,7 +139,7 @@ def generate_asciidoc_main_field(field_name: str, schema: Dict, required_fields: if "pattern" in field_data: pattern = escape_special_chars(field_data['pattern']) asciidoc_content += f"\n*Pattern:* `+{pattern}+` +" - asciidoc_content += f"\n*Required:* {'Yes' if field_name in required_fields else 'No'}\n\n" + asciidoc_content += f"\n*Required:* {'Yes' if is_required else 'No'}\n\n" # Generate the content for the properties, recursively handling nested properties if 'properties' in field_data: @@ -174,8 +174,9 @@ def generate_asciidoc_file(json_schema_path: str, output_path: str): asciidoc_content = f"= {headline}\n\n" for field in schema['properties']: + is_required = field in schema.get('required', []) required_fields = schema['properties'][field].get('required', []) - asciidoc_content += generate_asciidoc_main_field(field, schema, required_fields) + asciidoc_content += generate_asciidoc_main_field(field, schema, is_required, required_fields) output_filename = f"{os.path.splitext(base_filename)[0]}.adoc" output_file = os.path.join(output_path, output_filename)