National-Composites-Centre / CompoST

This repository serves as reference point for standard classes for composite definition.
MIT License
3 stars 2 forks source link

[Issue]: Composition in the schema #7

Open luke-ncc opened 1 week ago

luke-ncc commented 1 week ago

Describe the project you are working on

A simple CompoSt visualisation tool. This tool can be used to view surfaces, splines, and ply edges and cross-sections.

Describe the issue you have come across

The current schema defines each object structure in isolation, instead of leveraging object composition. This causes the structure to be bloated

What features of the format does this affect?

For example, the start of the definition of CompositeElement:

   "CompositeElement": {
          "properties": {
              "memberName": {
                  "anyOf": [
                      {
                          "type": "string"
                      },
                      {
                          "type": "null"
                      }
                  ],
                  "default": null,
                  "title": "Membername"
              },

And the start of the definition of Ply, which should be part of the composition of CompositeElement,

 "Ply": {
          "properties": {
              "memberName": {
                  "anyOf": [
                      {
                          "type": "string"
                      },
                      {
                          "type": "null"
                      }
                  ],
                  "default": null,
                  "title": "Membername"
              },

This could be simplified by only defining ply with properties specific to that object:

 "Ply": {
          "properties": {

              "material": {
                  "anyOf": [
                      {
                          "type": "string"
                      },
                      {
                          "type": "null"
                      }
                  ],
                  "default": null,
                  "title": "Material"
              },
              "orientation": {
                  "anyOf": [
                      {
                          "type": "number"
                      },
                      {
                          "type": "null"
                      }
                  ],
                  "default": null,
                  "title": "Orientation"
              },
              "splineRelimitationRef": {
                  "anyOf": [
                      {
                          "type": "integer"
                      },
                      {
                          "type": "null"
                      }
                  ],
                  "default": null,
                  "title": "Splinerelimitationref"
              }
          },
          "title": "Ply",
          "type": "object"
}

And then using composition by adding a property to the definition:

"allOf": [
    {
        "$ref": "#/$defs/CompositeElement"
    },
    {
     "Definition of a ply goes here": ""
    }
]

Version

v0.67

Relevant log output

No response