Comments (3)
I just realised there might be a related problem. We're using enums here instead of "anyOf" because I thought this would fix the generated union types from being re-sorted. What I mean by that, is that, from time to time
export type OrderBy = {
field?: 'order_1' | 'order_2';
};
would turn into
export type OrderBy = {
field?: 'order_2' | 'order_1';
};
which makes inspecting the diffs difficult, not to mention the fact it makes it more difficult to enforce that the codegen is up to date. (i.e. running it again doesn't generate any more diffs)
from openapi-ts.
Yep, this is the next step in improving generated enums!
from openapi-ts.
If the enum is named, it currently works very well in the sense that an enum (or union in this case) is generated and then used so that's a case we don't need to worry about.
For the other case, I feel like there are 2 ways to go about this, not entirely sure which is the more correct one:
- you can either try to generate a better name for the enum and use it, maybe taking the "parent" model name and concatenating the currently generating enum name, i.e.
OrderBy_field
in our case, at which point I'd rather make sure the field is named directly - you can just let the type inlined where it's used, so the only difference would be not generating the
field
at all
I prefer the 2nd option cause for the first one, there's a workaround. With that said, I assume it makes things more complicated when you have to be able to generate both unions/enums/javascript enums.
from openapi-ts.
Related Issues (20)
- Add option to generate `*.mts` files HOT 5
- OpenAPI parameters with the same name and different "in" types cause "Duplicate identifier" error in types.gen.ts HOT 2
- Empty JSON request body spec is created as an "unknown" type HOT 1
- Wasn't able to send a correctly formatted payload using application/x-www-form-urlencoded HOT 1
- Default export of the module has or is using private name 'ClientConfig'. HOT 2
- Types for the methods conflict when the same operation name is defined in multiple routes HOT 15
- Proper Angular support HOT 2
- External reference not resolved correctly HOT 1
- Why is accept hard coded? Can it be changed to */* until a better solution is created? HOT 5
- How to create my own client? HOT 14
- client-fetch: array of string in body unsupported
- Handle different http status like 200 or 204 HOT 5
- Support microsoft office Content-Type as binary HOT 3
- CancelablePromise type does not work with react suspense HOT 5
- Default content-type of application/json applied to requests even when no body HOT 2
- @hey-api/client-fetch does not really `throw` where it should HOT 3
- Object is possibly undefined this.httpRequest HOT 2
- @hey-api/client-fetch: Error is unknown when using default HOT 1
- @hey-api/client-fetch: TS type RequestResult is not exported
- Option for config filename
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openapi-ts.