Comments (17)
I don't have the time to write some tests, could I leave that to you?
from openapi-typescript-codegen.
Hi Pieter, let me check, I'll add some additional test cases for these scenarios.
from openapi-typescript-codegen.
Great! I'm currently seeing if I can make a PR to fix this.
from openapi-typescript-codegen.
Weird thing is that if I look at your code, it seems valid to me, yet with even version 0.4.4 I see the behaviour is wrong.
from openapi-typescript-codegen.
@PieterVanEde Can you share you spec with me? Is that possible?
from openapi-typescript-codegen.
Or the better question: if you generate it with the default options, does everything look good then?
from openapi-typescript-codegen.
Yep, after fooling around a bit, I've found the following:
- if generated with default options, all looks fine.
- if generated with everything set to false, the barrel file is empty (correct)
- if generated with
exportCore: true, exportModels: false, exportSchemas: false, exportServices: true,
then only the core and models end up in the barrel (wrong) - if generated with
exportCore: true, exportModels: true, exportSchemas: false, exportServices: false,
then I only get the core and services in the barrel (wrong) - and like that I see more cases where the generate flags seem to have effect on the wrong section in the barrel file.
from openapi-typescript-codegen.
Ah maybe the parsing logic of the booleans are wrong somehow, are using the Node API or using it via command line / package json?
from openapi-typescript-codegen.
The parsing is indeed wrong, I've linked my local checkout of my fork inside my test project, and added this to the top of the index.hbs:
{{#if exportCore}} // pieter was here: exportCore true {{/if}} {{#if exportModels}} // pieter was here: exportModels true {{/if}} {{#if exportSchemas}} // pieter was here: exportSchemas true {{/if}} {{#if exportServices}} // pieter was here: exportServices true {{/if}}
Result for config exportCore: true, exportModels: false, exportSchemas: false, exportServices: true,
is core and models
from openapi-typescript-codegen.
I'm using the typescript interface to call the library
from openapi-typescript-codegen.
Strangely enough, only the barrel file is wrong. The actual files that are output, are correct.
from openapi-typescript-codegen.
Error spotted, PR on its way
from openapi-typescript-codegen.
PR is created, hope you agree ;)
from openapi-typescript-codegen.
Cool, thanks for spotting this, stupid mistake, will push a new version to npm now
from openapi-typescript-codegen.
Pushed 0.4.5
from openapi-typescript-codegen.
I re-opend this as a reminder to add some test cases
from openapi-typescript-codegen.
Great! And well, there is a stupid mistake in a great library that I could use for free, so I don't see a problem ;)
from openapi-typescript-codegen.
Related Issues (20)
- While resolving: [email protected] HOT 1
- Unable to run when redocly is installed HOT 2
- Option to rename `requestBody` HOT 1
- Select/Filter Tags to generate specific Services only HOT 1
- Literal fields are converted to optional any HOT 5
- Adding the option to remove certain or all file headers. HOT 1
- Referenced nullable object types are not generated as possibly null HOT 4
- anyOf combining literals and objects generates incorrect code HOT 6
- Ability to process multiple input files HOT 5
- all Of -> $reference. HOT 3
- If all parameters are optional, make the top level object optional too HOT 4
- Generated type definitions should not include the error case HOT 3
- Relative path seems to be based on the node_modules directory and not the cwd HOT 3
- Support for Server Side Event HOT 3
- Wrong path on Windows HOT 16
- Unable to recognize the "openAPI" entry as the name of a Cmdlet, function, script file, or executable program. Please check the spelling of the name, if it includes Path, please make sure the path is correct and try again. HOT 7
- Error 'unknown option '--name' when using openapi-typescript-codegen version '0.13.0' HOT 1
- oneof enum generates incorrect code HOT 11
- Update sendRequest for axios to align on parameter deprecation (withCredentials) HOT 7
- [READ THIS!] This repository is not being maintained anymore. Use nicolas-chaulet/openapi-typescript-codegen instead! HOT 8
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-codegen.