Industrial-IoT icon indicating copy to clipboard operation
Industrial-IoT copied to clipboard

When trying to generate types in csharp, using the opc-publisher/openapi.json file... im getting this error:

Open RollsChris opened this issue 11 months ago • 4 comments

When trying to generate types in csharp, using the opc-publisher/openapi.json file... im getting this error:

fatal | Error: Unknown type for constant value for String 'int32'--cannot create constant value. fatal | Process() cancelled due to failure error | Error: Plugin modelerfour reported failure. error | Autorest completed with an error. If you think the error message is unclear, or is a bug, please declare an issues at https://github.com/Azure/autorest/issues with the error message you are seeing.

the command im running ( i renamed file to opcpublisher.json) is:

autorest --input-file=opcpublisher.json --csharp --ouput-folder=generated --verbose

does this mean that its broken ?

RollsChris avatar Mar 06 '24 11:03 RollsChris

Yes, I will look into this.

marcschier avatar Mar 07 '24 06:03 marcschier

If you would like to help, you could take the json file and identify the offending line(s), then manually update until autorest likes it. Then I can fix the swaggergen part and re-generate the json in main branch pretty quickly.

marcschier avatar Mar 07 '24 06:03 marcschier

i would but it does not tell me what line it is? or am i missing something.

How would you problem solve it, find the offending line.. .check the actual API implementation and see if the types match?

RollsChris avatar Mar 08 '24 08:03 RollsChris

Might be related to https://github.com/Azure/autorest.csharp/issues/4127 and the format for the enums breaking it. This used to work just fine a year ago when we still generated code but I must confess we have never run Autorest since then maybe this gives a clue and replacing the format int32 there is worth a try.

marcschier avatar Mar 08 '24 19:03 marcschier

Fixed in main for 2.9.10 target

marcschier avatar Jun 28 '24 07:06 marcschier