Comments (7)
It's working now (I see next was updated, nice!) Thanks!
from openapi-typescript.
@jeffpyke thanks for filing an issue! Yes that’s something being worked on for a 2.0
release of this library, which will be in beta soon.
You can preview an alpha build now with npx @manifoldco/swagger-to-ts@next …
.
The short version is that 1.0 tried to be “too smart” and abstract too much, but it results in errors like you’re seeing. 2.0 is a rewrite that is “dumber” in the sense that it perfectly mirrors your schema (and the library itself is also easier to maintain). You can follow progress on the roadmap.
Hopefully it’ll be released soon! Also, if you find that the @next
build doesn’t solve your problem, I’d love to get early feedback to make sure it does for the release (replying to this ticket is fine)
from openapi-typescript.
Thanks @DangoDev , I tried that and saw this error.
',' expected. (57:35)
"MyObject2": [object Object];
Please let me know if this is a known issue. If not I can provide a more detailed bug repro.
from openapi-typescript.
Hm. I’m actually surprised you’re seeing that on the @next
branch. Would you mind posting the full schema you’re using (or at least the part that errs)? Your example looks pretty similar to the test here which is passing currently: https://github.com/manifoldco/swagger-to-ts/blob/master/tests/v2/index.test.ts#L179
from openapi-typescript.
By the way, is there a way to remove the "definitions" namespace?
e.g.
definitions:
MyObject:
properties:
foo:
$ref: "#/definitions/FloatArray
FloatArray:
type: "array"
items:
type: "number"
format: "float"
becomes
export interface definitions {
MyObject: ...
}
preferred:
export interface MyObject: ...
from openapi-typescript.
By the way, is there a way to remove the "definitions" namespace?
Good question! You can actually change the name with type aliasing. E.g.
import { definitions } from './my-schema';
export type MyObject = definitions;
Or
import { definitions as MyObject } from './my-schema';
Or you can even combine schemas if you have to manage multiple:
import { definitions as schema1 } from './schema1';
import { definitions as schema2 } from './schema2';
export interface MyObject {
schema1: schema1;
schema2: schema2;
}
from openapi-typescript.
@manifoldco/[email protected]
was released! 🎉 This is a library rewrite that fixes these issues and adds OpenAPI 3.0 support. With the tests added I believe this resolves the issue. If that’s not the case, please re-open, or file another issue. Thanks!
(I know this is a repeat message and you’ve already been pinged for this; I’m just repeating for archival purposes, for people that search closed issues)
from openapi-typescript.
Related Issues (20)
- Cannot handle dynamic path parameters in the middle of a path
- Query serializer ignores explicit "explode" field value HOT 3
- Type discrimination between `data` and `error` doesn't work HOT 2
- Check/verify functionality for CLI HOT 1
- Enhancing openapi-typescript for Improved Type Safety: Generating Arrays from Enum Definitions HOT 4
- Headers passed in createClient not getting omitted from the headers in Client methods. HOT 1
- Transform only transforms referenced schemas HOT 1
- Hoping to wrap the client for single arg calls
- Metadata generation
- Allow client option for custom dispatcher into fetch requests (e.g. to disable certificate validation) HOT 6
- advice on how to connect a frontend (swagger?) while using this lib
- Set baseUrl per request
- 0.9.4 breaks some Typescript configurations HOT 3
- Response types from openapi-fetch ignore null values
- Multiple security schemes not supported
- With React Query: Invariant: headers() expects to have requestAsyncStorage, none available. HOT 3
- `--properties-required-by-default` and `--default-non-nullable` flags do not work HOT 1
- Nested object's properties are mapped to unknown, but in OpenAPI they are typed correctly HOT 3
- "AdditionalProperties" reflects onto existing properties and causes TypeScript compile errors HOT 1
- Issues with references (`$ref`) resolution HOT 2
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-typescript.