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

fix(typescript-generator)!: handle 'date' and 'date-time' for 'string'… #2192

Open
wants to merge 7 commits into
base: next
Choose a base branch
from

Conversation

roman-supy-io
Copy link

… data type

Description

Date type was not properly handled and resulted into string generated type output
This fixes the issue

Related Issue

Checklist

  • The code follows the project's coding standards and is properly linted (npm run lint).
  • Tests have been added or updated to cover the changes.
  • Documentation has been updated to reflect the changes.
  • All tests pass successfully locally.(npm run test).

Additional Notes

Copy link

netlify bot commented Feb 21, 2025

Deploy Preview for modelina canceled.

Name Link
🔨 Latest commit 71b2f46
🔍 Latest deploy log https://app.netlify.com/sites/modelina/deploys/67b86c85a4e37200082aae2f

@jonaslagoni jonaslagoni changed the title fix(typescript-generator): handle 'date' and 'date-time' for 'string'… fix(typescript-generator)!: handle 'date' and 'date-time' for 'string'… Feb 21, 2025
@jonaslagoni
Copy link
Member

@roman-supy-io remember to update all the test etc npm run test:update

Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides updating snapshots can you add two test to

test('should render type', () => {
?

You can use the Java tests as guideline: https://github.com/asyncapi/modelina/blob/master/test/generators/java/JavaConstrainer.spec.ts#L329

@roman-supy-io
Copy link
Author

@jonaslagoni tests updated

@jonaslagoni
Copy link
Member

@roman-supy-io did you run npm run test:library -- -u or npm run test:update? Looks like there is still some snapshots that has not been updated 🙂

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
41.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@roman-supy-io
Copy link
Author

@jonaslagoni all fixed
question, because we use docker hub version of a generator, will the docker image be updated automatically?

@jonaslagoni
Copy link
Member

@roman-supy-io which docker image specifically are you referring to?

@jonaslagoni
Copy link
Member

Regardless, because this is a breaking change, I dont think any automatic updates will happen.

@roman-supy-io
Copy link
Author

roman-supy-io commented Feb 21, 2025

@jonaslagoni right now we're using https://hub.docker.com/r/asyncapi/cli on our CI to generate Typescript contracts

UPD: oh, ok, so when can we expect this to be released?
And why is it a breaking change? I'd rather call it feature/fix for the current major version.

@jonaslagoni
Copy link
Member

@roman-supy-io you can read more about it here: https://github.com/asyncapi/modelina?tab=readme-ov-file#versioning-and-maintenance

Alternatively you can add a flag specifying an enum of types for date formats 🤔 i.e. string (default) and date so the output does not automatically break for the consumers of the models.

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

Successfully merging this pull request may close these issues.

4 participants