Giter VIP home page Giter VIP logo

servant-docs-simple's People

Contributors

jhrcek avatar kwannoel avatar turbomack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

turbomack jhrcek

servant-docs-simple's Issues

Fix name clash for document

Current the document function is implemented in 2 places.

  1. In Servant.Docs.Simple.Parse as a typeclass function for HasDocumentApi
  2. In Servant.Docs.Simple to convert a type to PlainText

We should remove this ambiguity and rename 1).

Support for older versions of Servant

Currently older versions (< 1.6) of Servant have differing implementation for Streams. Hence to support these we should create a new branch which are able to parse these.

A consequence of this is that we can only support resolver >= 8.6.5 and after as older resolvers use (< 1.6) versions of Servant.

Cleanup type-level lists in output

Current output as of v0.2.0.1

After calling typeRep on the format type '[JSON]

Response:
    Format: ': * JSON ('[] *)
    ContentType: User

Preferred output

Response:
    Format: [JSON]
    ContentType: User

Add support for all modifiers

Some modifiers are ignored when parsing an API type.

For example, for the following Api Fragment.

ReqBody' m ct typ

Only information from ct and typ are included.

Currently only Response type supports the modifiers.
We should include these in the HasDocument instances for relevant types.

Use better names for typeclasses

Names for typeclasses in Servant.Docs.Simple.Parse are not sufficiently informative about their usecase.

Solution

  • rename HasParsable to HasParsableApi
  • rename HasDocumentApi to HasParsableEndpoint

Convert underlying representation to HashMap

Currently the intermediate representation uses a linked list of pairs.

The structure of an API is more similar to a hashmap and this helps to prevent duplicate key:value pairs as well.

Eventually this should be in place.

Bug when handling query parameters

I am attempting generate documentation for once of my projects with the following API endpoint:

data MeadowMoodAndJournalingSite route = MeadowMoodAndJournalingSite
  { ... // other endpoints in the same hierarchy
   , mmajsGetEntries :: route
        :- "get-entries"
        :> QueryParam "page-no" Int
        :> QueryParam "search-string" Text
        :> Get '[Proto] Proto.MoodAndJournalEntries
  } deriving stock (Generic)

However, the documentation generated is as follows:

/api/meadow/mood-journaling/get-entries:
Authentication: MEADOW_SESSION
QueryParam:
    Param: search-string
    ContentType: Text
RequestType: 'GET
Response:
    Format: ': * Proto ('[] *)
    ContentType: MoodAndJournalEntries

For some reason, the second query parameter is missed when generating the documentation.

Implement markdown format

We should include markdown format as it is a commonly used format as well.

We should attempt to output it from the prettyprinter rendered format.

Some refactoring may have to be done with the Renderable instance for prettyprinter, such annotating keywords.

Readme to include link to tutorial

When scrolling through Readme, tutorial segment appears at the bottom. We should add a link to it so Users can easily access the section on tutorials

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.