Skip to main content
Solved

Documentation Comments to Data Model’s GraphQL When Deploying via Toolkit YAML Files


Forum|alt.badge.img+1

When we deploy Data Model using GraphQL then we can put some comments like documentation giving relevant info. This is helpful for people who look into Data Model’s graphql in web application. 

However, when we deploy using toolkit via yaml files the generated Data Model’s GraphQL do not have comments. Though we can add comment by editing in UI but that has to be done manually. 

Is there any way to have documentation in generated Data Model’s GraphQL when we deploy yaml files using toolkit?

Best answer by Ayush Daruka

I did not find anything as such to add a comment to the model. But to add information about any view or a property of the view, we can use the description field when we create the view definition. For example, CogniteDescribable as shown below. Please note the content of description in graphQL and definition file.
 

 

View original
Did this topic help you find an answer to your question?

8 replies

Ayush Daruka
Seasoned
  • Seasoned
  • 24 replies
  • Answer
  • February 6, 2025

I did not find anything as such to add a comment to the model. But to add information about any view or a property of the view, we can use the description field when we create the view definition. For example, CogniteDescribable as shown below. Please note the content of description in graphQL and definition file.
 

 


Anders  Albert
Seasoned Practitioner
Forum|alt.badge.img
  • Seasoned Practitioner
  • 96 replies
  • February 11, 2025

@Khilesh Sahu When you deploy through YAML files, do you mean that you deploy using views, containers, data models and so on? Ref https://docs.cognite.com/cdf/deploy/cdf_toolkit/references/resource_library#data-models
 

I assume with documentation you mean the name and description of the properties. As ​@Ayush Daruka  is saying, that comes from the View definition, were you see name (which is the display name) and description, which is the documentation.


Ayush Daruka
Seasoned
  • Seasoned
  • 24 replies
  • February 11, 2025
Anders Albert wrote:

@Khilesh Sahu When you deploy through YAML files, do you mean that you deploy using views, containers, data models and so on? Ref https://docs.cognite.com/cdf/deploy/cdf_toolkit/references/resource_library#data-models
 

I assume with documentation you mean the name and description of the properties. As ​@Ayush Daruka  is saying, that comes from the View definition, were you see name (which is the display name) and description, which is the documentation.

 

@Anders Albert Is it possible to add comments (in green as shown in the picture below), when we deploy a model through toolkit using yaml files?
 

 


Forum|alt.badge.img+1
  • Author
  • Committed
  • 16 replies
  • February 19, 2025

@Anders Albert  - any update on this?


Anders  Albert
Seasoned Practitioner
Forum|alt.badge.img
  • Seasoned Practitioner
  • 96 replies
  • February 19, 2025

@Ayush Daruka No. That is a comment in the GraphQL file and not part of the model. You can add a comment directly in the YAML file for example.

 

Any reason why you want an additional comments outside the description fields? 


Ayush Daruka
Seasoned
  • Seasoned
  • 24 replies
  • February 20, 2025

@Anders Albert There are additional information pieces around some fields that is not essentially the description of it. So, we were adding those as a comment to provide info about why we have done things a certain way. Thats why we wanted the resulting graphQL to also have the comments.


Anders  Albert
Seasoned Practitioner
Forum|alt.badge.img
  • Seasoned Practitioner
  • 96 replies
  • February 20, 2025

@Ayush Daruka Thank you for that, I really appreciate it, it is a perspective I missed here. If I understand you correctly, the description is for the consumer of the model to understand the data they are getting, while the comment is for the creator of the data model itself.

The way I have seen this solved when governing a data model with Toolkit is that the YAML files are version controlled, typically in GitHub or Azure Devops. Then, either with a Changelog, similar to the one for Toolkit here, and/or Pull requests descriptions + discussions the reasoning for why the modeling was done in a particular way. 


Ayush Daruka
Seasoned
  • Seasoned
  • 24 replies
  • February 20, 2025

@Anders Albert Thanks for the prompt replies. Yeah we can work around with that to store such information. Its just that it was way easier to do it that way, and understanding what was being talked about was also easy. But thanks for your help! 


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings