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

Auto-generated top-level text must include the @generated word (with @ prepended). #1604

Open
AIGeneratedUsername opened this issue Oct 6, 2023 · 2 comments · May be fixed by #1770
Open
Labels
help wanted Extra attention is needed

Comments

@AIGeneratedUsername
Copy link

AIGeneratedUsername commented Oct 6, 2023

Is your feature request related to a problem? Please describe.

Let's start with an example how other people use this. If you will take a look at https://github.com/koxudaxi/datamodel-code-generator/blob/master/poetry.lock#L1 you will see:

# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.

The @generated mark is described at https://generated.at/

Describe the solution you'd like

Prepend @ to the "generated" word.

Example:

# @generated by datamodel-codegen:
#   filename:  api.yaml
#   timestamp: 2023-10-06T07:55:02+00:00
@koxudaxi
Copy link
Owner

koxudaxi commented Oct 6, 2023

@AIGeneratedUsername
Thank you for suggesting the changes.
I wasn't familiar with the @generated tag.
Is it a standard in the generator world?

If someone has any thoughts on the advantages or disadvantages of adopting this, please feel free to share your opinions or vote.

@koxudaxi koxudaxi added the help wanted Extra attention is needed label Oct 6, 2023
@pjungermann
Copy link

It is widely used. However, not sure if we can call it a standard. https://generated.at/ tries to make it one. It is easier to recognize for tooling, though, compared to not adding the @ in front.

I was about to file a PR to suggest the same change.

A workaround so far is to use the following argument

--custom-file-header '# @generated by datamodel-codegen'

(Generally, I already use --disable-timestamp as it would cause issues with checks verifying that there are no missing generator changes otherwise.)

pjungermann added a commit to pjungermann/datamodel-code-generator that referenced this issue Dec 11, 2023
At the marker to "generated" at the file header
to make it easier for tooling to identify generated files as such.

Closes: koxudaxi#1604
Signed-off-by: Patrick Jungermann <[email protected]>
pjungermann added a commit to pjungermann/datamodel-code-generator that referenced this issue Dec 11, 2023
Add the marker to "generated" at the file header
to make it easier for tooling to identify generated files as such.

Closes: koxudaxi#1604
Signed-off-by: Patrick Jungermann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants