Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter api/models during generation #56

Closed
margarita-v opened this issue Oct 15, 2021 · 3 comments
Closed

Filter api/models during generation #56

margarita-v opened this issue Oct 15, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@margarita-v
Copy link
Contributor

It would be useful to filter api methods, for example to list the desired api methods for generation via additional config or parameters in command line separated with comma.

Motivation:

  1. This feature would be helpful for existed projects for changing the updated methods only
  2. This feature would help to avoid errors and to generate only those methods which can be generated successfully. The flexible configuration of generation could be possible.
  3. This feature would be helpful for projects with a single swagger api file in order to generate separate services for each particular case
@margarita-v margarita-v added the enhancement New feature or request label Oct 15, 2021
@chausovSurfStudio
Copy link

+1, when one of N methods in file have body with binary (or multipart) - only way is moved this method in separate file, which will be exclude from linting. And it's uncomfortable and sad :(

@LastSprint
Copy link
Contributor

LastSprint commented Oct 20, 2021

You mean exclude them from the whole process? Like to avoid the situation "Syntax is correct, but SufGen don't know how to handle it"?

I mean the idea is exclude specific models or services after parsing OpenAPI and don't even analyze it, isn't it?

@margarita-v
Copy link
Contributor Author

Yes, two options could be possible:

  1. Exclude some models, as described here Recursive models #57, so user can list particular model names which should not be parsed, the warning could be useful too: "SurfGen has skipped the model $modelName". For models which use the skipped one could be possible to replace its links to the skipped model in order to use the stub name. For example, Product has a ProductCategory field, but ProductCategory is skipped and won't be parsed, so the product's field could be category: TODO instead of using the name of skipped category (it also depends on template). Probably an additional field for model type could be useful as a sign of a skipped model.
  2. Exclude particular api methods and don't analyze them. For example, an api file has logout and login endpoints, but user wants to generate logout and ignore login endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants