Skip to content

OpenAPI Issues/ Feeback #62150

Open
Open
@niemyjski

Description

@niemyjski

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

This is a meta issue and all code is in a single repo. I've done extensive work on code gen on the client side for OpenAPI and found these when I first tried converting and haven't had time to log this. Thanks for all the work you all put into this, would love to contribute back but spread really thin.

cc @captainsafia

  1. HashSets doesn't generate correctly as it should include "uniqueItems": true. See SampleModel.ShouldHaveUniqueItemsTrue prop.
  2. long props are generated as integer | string types with a regex pattern. This should just be numeric, no regex. See SampleModel.ShouldNotHaveRegexPattern ([OpenAPI] integers have additional string type with pattern #61038 I think this covers it)
  3. [Required] public required string ShouldHaveMinLength { get; init; } is marked as required but doens't have a minlength. See SampleModel.ShouldNotHaveRegexPattern
  4. Enums with JsonStringEnumMemberName are not handled. You have to specifically set [JsonConverter(typeof(StringEnumConverter))]. See StackStatusWithJsonStringEnumMemberName Maybe AddOpenApi not respect JsonSerializerOptions Configurations #59980 ? Either way this should be handled out of the box without needing a converter?
  5. Version Props are missing the version pattern "pattern": "^\\d+(\\.\\d+){1,3}$". See SampleModel.Version
  6. Schemas is missing child types. For example I have CountResult which has a Dictionary<string, IAggregate>. IAggregate is not genereated nor any derived types.
  7. Enums are missing description, and x-enumNames. See SampleModel.BillingStatus (OpenApi Enums generating no schema #58230 (comment)) kind of covers this, but not addressed and x-ms-enum is not an industry standard and should be removed (If it is included this way which it is not).
  8. /// <response code="404">The web hook could not be found.</response> are missing from the generated output. See [HttpGet("open-api-model-issue")]
  9. Xml Documentation includes special new line characters that differ from previous versions. As such <code> blocks render incorrectly in different user interfaces driven off the json. see [HttpPost("post-body-issue-and-comments-issue")]
  10. No support for detecting which endpoints access Request.Body for streaming purposes. As such documentation is lacking. It should be assumed body is read if you have [Consumes("application/json", "text/plain")]
  11. Any type inside of Task<ActionResult<WorkInProgressResult>> (e.g., WorkInProgressResult is not included in the schema. See [HttpDelete("{ids}")]. I should not need [ProducesResponseType(typeof(WorkInProgressResult), StatusCodes.Status202Accepted)].
  12. Delta<> From OData days generates really weird. I don't have it included here but it generates a schema for each T in.. OData (e.g., DeltaOfUpdateUser) See (https://github.com/exceptionless/Exceptionless/blob/feature/net-10-upgrade-with-open-api-changes/src/Exceptionless.Web/Controllers/UserController.cs#L120)
  13. Not in the sample but public ICollection<OAuthAccount> OAuthAccounts { get; } = new Collection<OAuthAccount>(); should generate readOnly: true but does not.
  14. I'm pretty sure I had to add services.ConfigureHttpJsonOptions to get somethings to work can't remember what but I think it for casing to be picked up for JsonPropertyName in generation. This is weird and should just work if I have services.AddJsonOptions.
  15. Please address System.Text.Json changes the data datatype from double to int on serialization runtime#35195.

Expected Behavior

These should just work out of the box.

Steps To Reproduce

Clone https://github.com/exceptionless/aspnet-core-net10-issues# and run it, hit the open api json endpoint.

Exceptions (if any)

No response

.NET Version

10 preview 4

Anything else?

MacOS Latest, Rider/VS Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-openapi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions