Category Archives: openapi generator typescript fetch

Openapi generator typescript fetch

GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account.

openapi generator typescript fetch

Sorry for messing up the first PR. From what I saw in the code, this change mostly removes files and changes comments, but does not fix any issues? Is this PR missing some changes you did on your fork? No I think I must have just sweept it away when changeing things.

I can't see a reason for it though, enum values should be true to what they really are without type erasure. TiFu I'm happy to put these back in if required. I removed them because i've found that there's a general level of simplicity gained from just having a single file output. But perhaps with typescript project references coming in TS 3. TiFu We use the modelPropertyNaming flag to do response model property renaming. Currently it uses a runtime method to do the conversion but a better implementation would modify this to use a property name map.

The existing codegen, using the default camelCase for model property naming just causes broken code for clients. This is a major barrier for new users IMO when their first experience is a generator results in a broken default. TiFu this fork uses the response type of the request to support handling "string" response types. The original generator just calls response. The original generator will call response.

TiFu our generator supports middleware. This is a very useful feature and something that most HTTP clients contain. TiFu this fork also generates interfaces for all API parameters. The original generator uses inline type signatures which aren't reusable.

This fixes:. Oh thanks for the write up! No idea how I missed these changes earlier. Gonna do an in-depth review tonight.

Place1 could you have a look at the changes of JFCote in to avoid conflicts? Place1 great, so it should work out. Something I think we should try to add to this PR is to change the modelPropertyNaming implementation.

openapi generator typescript fetch

Currently it's a runtime method that generally works, but will fail in certain cases such as properties with a leading underscore. We should probably copy the approach so we can make sure this part of the generator is bullet proof.

openapi generator typescript fetch

Alright the PR looks good to me and I realized why I missed all those changes - api. Seems to need some fixing so that the CI tests pass see below. TiFu thanks for the breakdown. I'll try to fix these CI issues in the next few days. Perhaps we could adopt an implementation similar to the typescript-angular generator which uses method overloading to let the user request the API's json or the native Response from which they can get headers etc.

Place1 could you please update this PR and resolve the conflicts due to ? I'll be away for a few days do i'll have to get to the other action items later.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. Already on GitHub? Sign in to your account. Sorry for messing up the first PR. From what I saw in the code, this change mostly removes files and changes comments, but does not fix any issues?

Is this PR missing some changes you did on your fork? No I think I must have just sweept it away when changeing things. I can't see a reason for it though, enum values should be true to what they really are without type erasure. TiFu I'm happy to put these back in if required. I removed them because i've found that there's a general level of simplicity gained from just having a single file output.

But perhaps with typescript project references coming in TS 3. TiFu We use the modelPropertyNaming flag to do response model property renaming. Currently it uses a runtime method to do the conversion but a better implementation would modify this to use a property name map.

The existing codegen, using the default camelCase for model property naming just causes broken code for clients. This is a major barrier for new users IMO when their first experience is a generator results in a broken default. TiFu this fork uses the response type of the request to support handling "string" response types.

The original generator just calls response. The original generator will call response. TiFu our generator supports middleware. This is a very useful feature and something that most HTTP clients contain. TiFu this fork also generates interfaces for all API parameters. The original generator uses inline type signatures which aren't reusable. This fixes:. Oh thanks for the write up! No idea how I missed these changes earlier. Gonna do an in-depth review tonight.

Place1 could you have a look at the changes of JFCote in to avoid conflicts?

Config Options for typescript-fetch

Place1 great, so it should work out. Something I think we should try to add to this PR is to change the modelPropertyNaming implementation. Currently it's a runtime method that generally works, but will fail in certain cases such as properties with a leading underscore. We should probably copy the approach so we can make sure this part of the generator is bullet proof.

Alright the PR looks good to me and I realized why I missed all those changes - api. Seems to need some fixing so that the CI tests pass see below. TiFu thanks for the breakdown. I'll try to fix these CI issues in the next few days. Perhaps we could adopt an implementation similar to the typescript-angular generator which uses method overloading to let the user request the API's json or the native Response from which they can get headers etc.

Place1 could you please update this PR and resolve the conflicts due to ? I'll be away for a few days do i'll have to get to the other action items later.Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 40 million developers. For a full list of changes, please refer to "List of all changes". List of all changes. It comes with 1 new generator: typescript-redux-query.

We appreciate all the contributions from the community and look forward to more contributions from the awesome community in For a full list of changes, please refer to the list below:. As always, we're very grateful for the contributions from the awesome community. List of breaking changes with fallbacks. Another bi-weekly patch release.

For a full list of changes, please refer to the Pull Request page. Below are the highlights:. Thanks for the OpenAPI Generator community to help move the project forward with another minor release. We've also launched a new Slack workspace. The last patch release before 4. Below please find the highlight of the changes.

For a full list, please refer to the Pull Request page. Note: we'll also talk about this release in Open Summit Japan Skip to content. Dismiss Be notified of new releases Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 40 million developers. Sign up. Releases Tags. Latest release. This commit was created on GitHub. Choose a tag to compare.This page demonstrates navigating the options via CLI.

Commands are presented here in a logical progression as a tutorial, but you're welcome to skip directly to the generate command. The version command provides version information, returning either the semver version by default or the git sha when passed --sha. The list command outputs a formatted list of every available generator. You may pass any generator name see list command to -gand options specific to that generator will be displayed.

Some generators have many options, while others may have only a few. To pass these go client generator-specific options to the generate command for a go client, use the --additional-properties option. See the generate command section for an example. The meta command creates a new Java class and template files, used for creating your own custom templates. For an in-depth example of using the meta command, see Customization.

The validate command allows you to validate an input specification, optionally providing recommendations for error fixes or other improvements if available. Valid Spec Example using petstore-v3.

Invalid Spec Example using petstore-v3. Although not documented in the help output, the CLI offers a completion command, which can be used for auto-completion. This command takes one or more parameters representing the args list you would otherwise pass to openapi-generator. For example:. The generate command is the workhorse of the generator toolset. As such, it has many more options available than the previous commands.

The abbreviated options are below, but you may expand the full descriptions. The following examples use petstore. For the full list of generator-specific parameters, refer to generators docs.

Most generators allow for types bound to the OpenAPI Specification's types to be remapped to a user's desired types. Not all type mappings can be reassigned, as some generators define mappings which are tightly coupled to the built-in templates. See DefaultCodegen. Sometimes you don't want the codegen to make a model for you--you might want to just include one that already exists in your codebase.

Say you already have a User object and want to reuse that, which has a different model package from the other generated files:. First, indicate that the class is already included by default. This will keep the codegen from trying to generate the class. This command line option will tell the generator to consider Pet a "primitive" type. Next, if the Pet class is a different package, add an --import-mapping to tell the generator to include that import wherever Pet is used:. NOTE: import-mappings is assigned a key-value pair in this example, but multiple values can be comma-separate.

For instance:. These settings can be passed via -c filename. Here, we've saved the above as config. The settings are passed exactly the same as for config.

openapi generator typescript fetch

The most important part is the file extension. Supported values are yml or yaml. The name of the file should be config. NOTE : This command supports an additional!OpenAPI Generator. Option Description Values Default allowUnicodeIdentifiers boolean, toggles whether unicode identifiers are allowed in names or not, default is false false ensureUniqueParams Whether to ensure parameter names are unique in an operation rename parameters that are not.

A special 'v4-compat' value enables the backward-compatible behavior as pre v4. Required to generate a full package null npmRepository Use this property to set an url your private npmRepo in the package. If not provided, using the version from the OpenAPI specification file. Edit this page. Last updated on by Nicholas Muesch. Suffix that will be appended to all enum names. The name under which you want to publish generated npm package. Required to generate a full package.

The version of your npm package. Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.

Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. Setting this property to true will generate interfaces next to the default class implementations.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. Already on GitHub? Sign in to your account.

This PR is a follow-up of Unfortunately I messed up that branch's history, so I opened another PR including the changes suggested by macjohnny and wing This PR aims to add support for Bearer authentication token to typescript-fetch generator. This PR is inspired by: mrvdot 82fc. CC: TiFu taxpon sebastianhaas kenisteward Vrolijkx macjohnny nicokoenig topce. Thanks again for the PR, which has been included in the v4.

Only this. Line fails to compile. I fixed it in Skip to content. Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Sign up. New issue. Conversation 11 Commits 4 Checks 0 Files changed. Copy link Quote reply. PR checklist Read the contribution guidelines. Ran the shell script under. For instance, only need to run. Windows batch files can be found in. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.

Filed the PR against the correct branch : master4. Default: master. Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR This PR is a follow-up of Unfortunately I messed up that branch's history, so I opened another PR including the changes suggested by macjohnny and wing This PR aims to add support for Bearer authentication token to typescript-fetch generator. This comment has been minimized. Sign in to view. View changes. Merge branch 'master' of github. I performed all the steps you asked and the pushed the branch again.

I'm working on a fix for that Go generator. Sign up for free to join this conversation on GitHub.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. Already on GitHub?

Subscribe to RSS

Sign in to your account. The problem: When using latest openapi-generator there is a lot of differences in generated client codebase. We have quite a big code base generated automatically using swagger-codegen There are some 35 of different REST controllers and we have build automation script that generates typescript-fetch API clients for them during the build process and in general it works very well and everyone is happy.

Express + TypeScript + Mongo Part 4 - Swagger

But I think in version 3 of swagger codegen there were introduced lots of changes. The most annoying change is switching from object-structured parameters to plain parameters. Compare this code which invokes generated api: Before.

I do not like that names of parameters are not presented now. In some cases we have lots of string parameters and here I see several disadvantages in this approach:. Having an option would allow to choose and therefore to fit both approaches. This could also be extended to all typescript-based generators, maybe TiFu would like to consider this when reworking the typescript generators? I'd be very interested in using it as the foundation for a rework of typescript-fetch over here.

Generators List

It follows the params object as api method argument and fixes a bunch of other issues present in the generator related to form data and model naming conversions camelCaseadditionally, it supports middleware.

Place1 thanks for sharing! TiFu could you have a look at this? I didn't have any time to start working on it yet due to another project running sideways but my schedule should become more relaxed now. Where can I find documentation on the template variables that swagger-codegen produces in the latest version?

I'm not sure if there's documentation for it, but you can print the available template variables. If you search the code base for debugOperations you can also find the other debug switches. Skip to content.

Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Sign up. New issue. Jump to bottom. Generated client with typescript-fetch generator is very different from swagger-codegen Copy link Quote reply.

Compare this code which invokes generated api: Before await this. In some cases we have lots of string parameters and here I see several disadvantages in this approach: When I do not see the names then it is not readable anymore.

Generators List

Error could be easily added when I put them in wrong order. Also if someone at backend decide to change parameter name and order like remove something called projectId and add different required parameter called parentObjectId then new generated client will still be compatible because there is just a bunch of string parameters in API call without information about the name. Any ideas why this change was introduced?

Probably I just do not see the benefits from it? This comment has been minimized. Sign in to view. Ah that's a very good idea.


This entry was posted in openapi generator typescript fetch. Bookmark the permalink.

Responses to Openapi generator typescript fetch

Leave a Reply

Your email address will not be published. Required fields are marked *