nodejs-template icon indicating copy to clipboard operation
nodejs-template copied to clipboard

fix: log the name of the message if it is absent

Open ibishal opened this issue 1 year ago • 7 comments

Description Added a param messageRuntimeValidation which will log the messageId's if its missing and if false then it will not warn anything(by default it will be true) Screenshot from 2024-07-02 02-18-41 image

image image

Related issue(s) #197

ibishal avatar Jun 20 '24 22:06 ibishal

I'm only worried for those that do not care about validation, and cannot modify their documents to add identifiers, what in their case. We should probably allow to disable validation?

Hey @derberg i have not added this feature, we need to make changes in asyncapi/generator for it right ?

ibishal avatar Jun 20 '24 22:06 ibishal

@ibishal no need to add anything to generator.

You simply need to introduce "parameter" feature. So let's say it is called messageRuntimeValidation that by default is set to true. If set to true, we add in generated code message validation code, and we also console log info that some message identifiers are missing. And we also need to log "that if you are not able to modify your asyncapi document to add missing IDs, then disable runtime validation logic by passing parameter messageRuntimeValidation set to false"

makes sense?

derberg avatar Jun 24 '24 09:06 derberg

Done @derberg

ibishal avatar Jul 01 '24 20:07 ibishal

I don't think you tested it manually as just looking at the code I see it errors.

I have done manual testing for it. you can see it in the sc of pr description

messageRuntimeValidation parameter is not added to package.json to generator config

It was added in the parameter of generator config in package.json

no info in readme

will add it

ibishal avatar Jul 18 '24 17:07 ibishal

Do we need integration test here @derberg

ibishal avatar Jul 18 '24 17:07 ibishal

I think I mixed the issues scope :(

in general idea was that best DX is that user gets a feedback during generation, and not once the template is generated and code build and running

sorry but instead of parameter I think we need generate:before that will do it -> https://www.asyncapi.com/docs/tools/generator/hooks

wdyt?

derberg avatar Aug 03 '24 21:08 derberg

sorry but instead of parameter I think we need generate:before that will do it -> https://www.asyncapi.com/docs/tools/generator/hooks

Looks Good

ibishal avatar Aug 25 '24 22:08 ibishal

closing, no further activity from the contributor

derberg avatar Nov 04 '24 16:11 derberg

@derberg, sorry from my side

i want to finish it, can we open this?

ibishal avatar Nov 07 '24 10:11 ibishal

just reopen new PR but updated according to previous feedback

derberg avatar Nov 11 '24 09:11 derberg