swagger-api/swagger-codegen

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

Open

#3,033 创建于 2016年6月2日

在 GitHub 查看
 (6 评论) (0 反应) (0 负责人)HTML (5,474 fork)batch import
Issue: BugServer: Haskellhelp wanted

仓库指标

Star
 (12,701 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.).

贡献者指南