swagger-api/swagger-codegen

[HASKELL] Generated types do not produce/consume JSON according to spec

Open

#3.033 geöffnet am 2. Juni 2016

Auf GitHub ansehen
 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)HTML (5.474 Forks)batch import
Issue: BugServer: Haskellhelp wanted

Repository-Metriken

Stars
 (12.701 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Description

In a Swagger spec file, when specifying eg. "payment_data" as a field name in an object, the resulting Haskell type produces (and consumes) JSON with a field name of "PaymentData". So eg. "channel_value_left" becomes "ChannelValueLeft". This breaks compatibility with the client library.

Swagger-codegen version

master @ a3610f1c12e5d7912cf2e9f16dff2152ef40291b

Swagger declaration file content or url

https://gist.github.com/runeksvendsen/305a3018fe48723998851419c2e4393d

Command line used for generation
$ java -jar swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -l haskell -i swagger.yaml
$ java -version
    java version "1.8.0_92"
    Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
    Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
Steps to reproduce
wget https://gist.githubusercontent.com/runeksvendsen/305a3018fe98851419c2e4393d/raw/5d022bdef0355128c54d2235ea986aa84efa3e3e/swagger.yaml
java -jar swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -l haskell -i swagger.yaml
cat lib/BitcoinPaymentChannelRESTProtocol/Types.hs
Suggest a Fix

Perhaps add a config option like the modelPropertyNaming option that typescript-node has, which allows choosing word separation semantics ('camelCase', 'PascalCase', 'snake_case' etc.).

Contributor Guide