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

[Elm] import 'Data.List_' not used, but causing an error #1378

Closed
Stealthmate opened this issue Nov 5, 2018 · 3 comments
Closed

[Elm] import 'Data.List_' not used, but causing an error #1378

Stealthmate opened this issue Nov 5, 2018 · 3 comments

Comments

@Stealthmate
Copy link

Description

I'm generating an API from haskell's servant-swagger, where an endpoint returns a type QueryResponse which is an object with two array fields.
The output file for this a module Data.QueryResponse, which has the import line

import Data.List_ as List_ exposing (List_)

however, List_ is not used anywhere in the file. On top of that, Elm doesn't recognize any module like that, and from what I've found there isn't one.

openapi-generator version

3.3.2, built from source from current master

OpenAPI declaration file content or url

gist

Command line used for generation

openapi-generator-cli.sh generate -i "http://localhost:8080/swagger.json" -l elm -o ./api

Steps to reproduce

Just execute the above command on a host that serves the file

Related issues/PRs

I tried looking for similar issues, but didn't find anything.

Suggest a fix/enhancement

I'm not really sure, but I think just simply not importing List_ would do the trick.

@Stealthmate
Copy link
Author

I noticed some other problems.

  • The API returns [[string]], however the template generated is for List String (the data field)
  • The encoder/decoder functions use String.encoder / String.decoder respectively, however those don't exist.

Here's a gist of the code as well.

I think nested list generation may not be working properly. I'll try to do some more research during the week if I have time.

@eriktim
Copy link
Contributor

eriktim commented Nov 22, 2018

Thanks for your report @Stealthmate. List_ is indeed a bug as nested Lists/Dicts were not yet supported. See the PR for a fix for both.

@Stealthmate
Copy link
Author

@trenneman Thank you! I'll take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants