swagger-api / swagger-api/swagger-codegen

[Haskell] README.md instructions don't work OOTB

Open
#5,101 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature: Documentation help wanted Server: Haskell
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The example instructions for creating a client and a server in README.md don't work OOTB. Not for client nor server.

Swagger-codegen version

v2.2.2 or latest master, doesn't matter.

Swagger declaration file content or url

Tried with both a large/complex company-private Swagger, and the Petstore sample:
sh ./bin/haskell-servant-petstore.sh
cd samples/server/petstore/haskell-servant

Same results either way.

Steps to reproduce
  1. git clone https://github.com/swagger-api/swagger-codegen && cd swagger-codegen
  2. git checkout origin master && git pull origin master --rebase
  3. mvn clean package
  4. sh ./bin/haskell-servant-petstore.sh
  5. cd samples/server/petstore/haskell-servant
  6. stack install
  7. Create a Main.hs file and try to import/use the generated client or server using the example code from the README.md, i.e:
{-# LANGUAGE RecordWildCards #-}

module Main where

import SwaggerPetstore.API

main :: IO ()
main = do
  SwaggerPetstoreBackend{..} <- createSwaggerPetstoreClient (ServerConfig "localhost" 8080)
  return ()
Results
Main.hs:9:33:
    Couldn't match expected type ‘ServerConfig
                                  -> IO (SwaggerPetstoreBackend t0)’
                with actual type ‘SwaggerPetstoreBackend SwaggerPetstoreClient’
    The function ‘createSwaggerPetstoreClient’
    is applied to one argument,
    but its type ‘SwaggerPetstoreBackend SwaggerPetstoreClient’
    has none
    In a stmt of a 'do' block:
      SwaggerPetstoreBackend {..} <- createSwaggerPetstoreClient
                                       (ServerConfig "localhost" 8080)
    In the expression:
      do { SwaggerPetstoreBackend {..} <- createSwaggerPetstoreClient
                                            (ServerConfig "localhost" 8080);
           return () }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with samples/server/petstore/haskell-servant/README.md and reproduce the issue using sh ./bin/haskell-servant-petstore.sh, stack install, and the shown Main.hs example. Compare the README's client and server instructions with the generated SwaggerPetstore.API entry points; done means both examples work as documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.