Skip to content

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

Closed
roman-supy-io wants to merge 8 commits intoasyncapi:nextfrom
roman-supy-io:patch-1
Closed

fix(typescript-generator)!: handle 'date' and 'date-time' for 'string'…#2192
roman-supy-io wants to merge 8 commits intoasyncapi:nextfrom
roman-supy-io:patch-1

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

@netlify
Copy link

netlify bot commented Feb 21, 2025

Deploy Preview for modelina canceled.

Name Link
🔨 Latest commit 464f198
🔍 Latest deploy log https://app.netlify.com/sites/modelina/deploys/67c45b96ddddb20008d740e1

@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 🙂

@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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 2, 2025

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@jonaslagoni jonaslagoni closed this Jun 3, 2025
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.

2 participants