ITADN

OpenAPI.Document is not a discriminated union and I wish it was one

#158Closedtmcw 创建于 2024-07-09
bug
T
tmcwcommented
### What happens? Per #157 this is kind of a feature request, but discussions aren't turned on. When I run a document through `deference` or `upgrade`, I get the `OpenAPI.Document` type. This type contains a bunch of union fields, like `.paths` is a union between all possible paths types: ![CleanShot 2024-07-09 at 12 53 44@2x](https://github.com/scalar/openapi-parser/assets/32314/3cfe68f1-ffa3-4221-adfc-4f846fbed2d4) It'd be ideal to: - Have this type be a discriminated union based on the value of `.openapi` - Have `upgrade` return a v3.1 type, because it should always be upgrading to that As it is, it's tricky to work with the types because they are too flexible. ### What did you expect to happen? These types would be discriminated ### How can we reproduce the issue? … ### Swagger/OpenAPI Example http://
关闭于 2024-07-23 2 条评论