Skip to content

Commit

Permalink
Added list of XML base types to DataTypes.md
Browse files Browse the repository at this point in the history
  • Loading branch information
CBenghi committed May 4, 2024
1 parent 8e9d212 commit 850abe5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 7 deletions.
32 changes: 26 additions & 6 deletions ids-lib.codegen/IfcSchema_DocumentationGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,51 @@ internal class IfcSchema_DocumentationGenerator
{
internal static string Execute(Dictionary<string, typeMetadata> dataTypeDictionary)
{
StringBuilder sb = new StringBuilder();
var schemas = new string[] { "Ifc2x3", "Ifc4", "Ifc4x3" };

StringBuilder sbDataTypes = new StringBuilder();
foreach (var dataType in dataTypeDictionary.Values.OrderBy(x=>x.Name))
{
var checks = schemas.Select(x => dataType.Schemas.Contains(x) ? "✔️ " : "");
sbDataTypes.AppendLine($"| {dataType.Name,-45} | {string.Join(" | ", checks),-24} | {dataType.XmlBackingType,-21} |");
}


sb.AppendLine($"| {dataType.Name,-45} | {string.Join(" | ", checks),-24} | {dataType.XmlBackingType,-21} |");
StringBuilder sbXmlTypes = new StringBuilder();
var xmlTypes = dataTypeDictionary.Values.Select(x => x.XmlBackingType).Where(str => !string.IsNullOrWhiteSpace(str)).Distinct();
foreach (var dataType in xmlTypes.OrderBy(x => x))
{
sbXmlTypes.AppendLine($"| {dataType,-11} |");
}

var source = stub;
source = source.Replace($"<PlaceHolderTable>", sb.ToString());
source = source.Replace($"<PlaceHolderDataTypes>", sbDataTypes.ToString().TrimEnd('\r', '\n'));
source = source.Replace($"<PlaceHolderXmlTypes>", sbXmlTypes.ToString().TrimEnd('\r', '\n'));
return source;
// Program.Message($"no change.", ConsoleColor.Green);
}

private const string stub = @"# DataTypes
private const string stub = @"# Type constraining
## DataTypes
Property dataTypes can be set to any values according to the following table.
Columns of the table determine the validity of the type depending on the schema version and the required `xs:base` type for any `xs:restriction` constraint.
| dataType | Ifc2x3 | Ifc4 | Ifc4x3 | Restriction base type |
| --------------------------------------------- | ------ | ------ | ------ | --------------------- |
<PlaceHolderTable>
<PlaceHolderDataTypes>
## XML base types
The list of valid XML base types for the `base` attribute of `xs:restriction` is:
| Base type |
| ----------- |
<PlaceHolderXmlTypes>
## Notes
Please note, this document has been automatically generated via the IDS Audit Tool repository, any changes should be initiated there.
";
Expand Down
20 changes: 19 additions & 1 deletion ids-lib.codegen/buildingSMART/DataTypes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# DataTypes
# Type constraining

## DataTypes

Property dataTypes can be set to any values according to the following table.

Expand Down Expand Up @@ -399,5 +401,21 @@ Columns of the table determine the validity of the type depending on the schema
| IFCWORKSCHEDULETYPEENUM || ✔️ | ✔️ | xs:string |
| IFCYEARNUMBER | ✔️ ||| xs:integer |

## XML base types

The list of valid XML base types for the `base` attribute of `xs:restriction` is:

| Base type |
| ----------- |
| xs:boolean |
| xs:date |
| xs:dateTime |
| xs:double |
| xs:duration |
| xs:integer |
| xs:string |
| xs:time |

## Notes

Please note, this document has been automatically generated via the IDS Audit Tool repository, any changes should be initiated there.

0 comments on commit 850abe5

Please sign in to comment.