microsoft / kiota

OpenAPI based HTTP Client code generator
https://aka.ms/kiota/docs
MIT License
2.92k stars 203 forks source link

Issue with Microsoft.AspNetCore.JsonPatch.JsonPatchDocument #2677

Closed waynehearn closed 1 year ago

waynehearn commented 1 year ago

I am using Microsoft's implementation of JsonPatch in our api. Our api is running on asp.net and uses Swagger to generate the OpenApi schema. The JsonPatch document types throw errors when kiota trys to generate the C# client.

Error: KiotaBuilder OpenAPI error: #/components - The key 'Microsoft.AspNetCore.JsonPatch.JsonPatchDocument1[Mozu.ProductAdmin.Contracts.Product]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. and also Error: KiotaBuilder OpenAPI error: #/components - The key 'Microsoft.AspNetCore.JsonPatch.Operations.Operation1[Mozu.ProductAdmin.Contracts.Product]'

This seems to be related to the generic type syntax. I've used some other OpenApi tools that don't seem to have issue with this syntax in the schema.

Here is what is in the schema: { "Microsoft.AspNetCore.JsonPatch.JsonPatchDocument1[Mozu.ProductAdmin.Contracts.Product]": { "type": "object", "properties": { "operations": { "type": "array", "items": { "$ref": "#/components/schemas/Microsoft.AspNetCore.JsonPatch.Operations.Operation1[Mozu.ProductAdmin.Contracts.Product]" }, "nullable": true } }, "additionalProperties": false }

darrelmiller commented 1 year ago

This error is coming from the OpenAPI.NET library because that is not a valid name for an OpenAPI component.
See the specification https://spec.openapis.org/oas/latest.html#fixed-fields-5

This is an issue that should be raised against Swashbuckle.