Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML Export "definitions" does not work like expected #514

Open
SabineGl opened this issue Nov 19, 2024 · 1 comment
Open

HTML Export "definitions" does not work like expected #514

SabineGl opened this issue Nov 19, 2024 · 1 comment

Comments

@SabineGl
Copy link

Hello,

we would like to separate field details in model.fields and reference it to the "definition" section like this:

models:
  public_address:
    type: table
    description: my table description
    title: my_table
    fields:
      first_column:
        $ref: '#/definitions/first_column'
        type: string  # integer, array ...          
        description: first column description
        required: true
        unique: true
        primaryKey: true # primary key        
      my_second_column:
        type: integer
        description: second column description
      my_third_column:
        type: string
        description: an other description
        references: foreign.key.table
definitions:
  first_column:
        type: string  # integer, array ...   
        title: An optional string describing the semantic of the data in this field
        references: database.schema.table.column #database.schema.column of foreignKey references
        pii: true
        classification: sensitive
        tags: ["myTag", "mySecondTag"]
        links: 
          URLToWebpage: https://example.com
        enum: ["good", "better", "best"] #A value must be equal to one of the elements in this array value. Only evaluated if the value is not null
        minLength: 5  #A value must greater than, or equal to, the value of this. Only applies to string types.
        maxLength: 500  #A value must less than, or equal to, the value of this. Only applies to string types
        format: email #A specific format the value must comply with (e.g., 'email', 'uri', 'uuid').        
        pattern: "^[a-zA-Z0-9_-]+$" # A regular expression the value must match. Only applies to string types
        minimum: 5 # A value of a number must greater than, or equal to, the value of this. Only evaluated if the value is not null. Only applies to numeric values.
        exclusiveMinimum: 10 #A value of a number must greater than the value of this. Only evaluated if the value is not null. Only applies to numeric values.
        maximum: 100000 #A value of a number must less than, or equal to, the value of this. Only evaluated if the value is not null. Only applies to numeric values.
        exclusiveMaximum: 15500 # A value of a number must less than the value of this. Only evaluated if the value is not null. Only 

But if I'm using the datacontract cli to export the HTML it shows the attributes twice: once in models.fields and additionally in definition. But I configured only primaryKey, unique and description in "models.field" and the rest in definition (see yml).

export datacontrac cli output:
image

I tested it with "online data contract editor" https://editor.datacontract.com/
Here it works perfectly fine:
image

Thanks you very much!

@jochenchrist
Copy link
Contributor

Thanks for reporting this bug.

If you want to speed up the fix and feel comfortable with Python, you could look at the source to provide a pull request with the fix. Entry point would be here:
https://github.com/datacontract/datacontract-cli/blob/main/datacontract/export/html_export.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants