Use the official OpenAPI specification to generate types
### Discussed in https://github.com/unitycatalog/unitycatalog-ui/discussions/54
<div type='discussions-op-text'>
<sup>Originally posted by **ognis1205** July 26, 2024</sup>
The URL paths, requests, and responses of the backend server to be used are strictly defined by the OpenAPI specification.
I think it is better to automatically generate TypeScript interfaces from OpenAPI and then define the paths as union types and the requests and responses as interfaces synchronized with the OpenAPI specification using utility types.
Additionally, rather than using fetch, if you use third-party libraries like axios and implement some utilities, you can implement everything in a type-safe manner with interfaces synchronized with OpenAPI in a single API.</div>
6 条评论