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

[haskell-http-client] handle */* mimetype correctly & split api modules & allowNonUniqueOperationIds #7254

Merged
merged 3 commits into from
Jan 7, 2018

Conversation

jonschoning
Copy link
Contributor

@jonschoning jonschoning commented Dec 26, 2017

  1. This change allows the user to choose any any content type for serialization when the spec consumes */*. (The current behavior forces the user to use MimeAny which does does not provide a method of serialization)

  2. Also, generate separate api modules, for each child api. (similar to how the other generators split out the APIS into separate files)
    Instead of putting all the API operations into one file, each API gets its own module/file under API/ (e.g. API/Store.hs)

  3. Add add a cliOption "allowNonUniqueOperationIds" (default False). When cli option "allowNonUniqueOperationIds" is true, allows different API modules to contain the same operationId, and then each API must be imported qualified.

@jonschoning jonschoning changed the title [haskell-http-client] handle */* mimetype correctly [haskell-http-client] handle */* mimetype correctly. gen separate api modules Dec 28, 2017
@jonschoning jonschoning changed the title [haskell-http-client] handle */* mimetype correctly. gen separate api modules [haskell-http-client] handle */* mimetype correctly & split api modules Dec 28, 2017
When cli option "allowNonUniqueOperationIds" is true,
allows *different* API modules to contain the same operationId,
and then each API must be imported qualified.
@jonschoning jonschoning changed the title [haskell-http-client] handle */* mimetype correctly & split api modules [haskell-http-client] handle */* mimetype correctly & split api modules & allowNonUniqueOperationIds Dec 30, 2017
@wing328 wing328 changed the base branch from master to 2.4.0 January 7, 2018 03:58
@wing328 wing328 merged commit bca2b9f into swagger-api:2.4.0 Jan 7, 2018
@jonschoning jonschoning deleted the haskell-http-client-dev branch January 7, 2018 08:26
@guoshimin
Copy link
Contributor

Thanks for doing this, @jonschoning! How hard would it be to break up Model.hs into submodules as well? Can the same technique apply?

@jonschoning
Copy link
Contributor Author

jonschoning commented Jan 11, 2018

The same technique cannot be naively applied to create a module per model, because unlike APIs, models often depend on other models, and there can even be circular depdencies between models.

In theory one could figure out the imports for each model, but Haskell definitely doesn't allow circular imports, and Kubernetes has those too.

Notice other languages put all models into the same module/namespace, just with separate files.
(In Haskell, separate files force separate modules/namespaces)
I don't think they try to figure out the imports needed to put each model in it's own namespace.

But let me know if I've missed something.

@guoshimin
Copy link
Contributor

I see. No big deal then.

chiman-jang pushed a commit to chiman-jang/swagger-codegen that referenced this pull request Jan 16, 2018
…es & allowNonUniqueOperationIds (swagger-api#7254)

* [haskell-http-client] handle */* mimetype correctly

* [haskell-http-client] generate separate api modules, for each child api

* [haskell-http-client] add cliOption "allowNonUniqueOperationIds"

When cli option "allowNonUniqueOperationIds" is true,
allows *different* API modules to contain the same operationId,
and then each API must be imported qualified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants