BSD-3-Clause licensed by Nickolay Kudasov
Maintained by [email protected]
This version can be pinned in stack with:swagger2-1.0@sha256:31905aa6783baa5bace6a1d87569fb12224f83523f71bb30ca6406c9fee3bca9,2327

swagger2

Hackage Build Status

Swagger 2.0 data model.

The original Swagger 2.0 specification is available at http://swagger.io/specification/.

Usage

This library is inteded to be used for decoding and encoding Swagger 2.0 API specifications as well as manipulating them.

Please refer to haddock documentation.

Some examples can be found in examples/ directory.

Trying out

All generated swagger specifications can be interactively viewed on Swagger Editor.

Ready-to-use specification can be served as JSON and interactive API documentation can be displayed using Swagger UI.

Many Swagger tools, including server and client code generation for many languages, can be found on Swagger’s Tools and Integrations page.

Contributing

We are happy to receive bug reports, fixes, documentation enhancements, and other improvements.

Please report bugs via the github issue tracker.

GetShopTV Team

Changes

1.0

  • Major changes:

    • Add Data and Typeable instances for Data.Swagger types;
    • Merge ParamType/ItemsType/SchemaType into SwaggerType GADT;
    • Merge collection format types into CollectionFormat GADT;
    • Introduce SwaggerItems GADT, replacing Items and SchemaItems in ParamSchema (see #24);
    • Move type, format and items fields to ParamSchema (former SchemaComon);
    • Prepend reference path automatically (see commit 49d1fad) and thus remove "#/definitions/" from user code, leaving much clearer Reference "Name";
    • Change Data.Swagger.Schema (see #19):
      • Change the only method of ToSchema to declareNamedSchema which should produce a NamedSchema along with a list of schema definitions used to produce it;
      • Add declareSchema, declareSchemaRef;
      • Replace genericTo* helpers with genericDeclare* helpers;
      • Add paramSchemaTo[Named]Schema helpers to facilitate code reuse for primitive schemas;
      • Add helpers for inlining Schema references dynamically (see #23);
    • Add ToParamSchema class (see #17) with
      • generic default implementation and
      • instances for some base types compliant with http-api-data instances;
    • Add Data.Swagger.Declare module with
      • DeclareT monad transformer;
      • MonadDeclare type class;
      • various helpers;
    • Rename parameter-related types:
      • Parameter -> Param;
      • ParameterSchema -> ParamAnySchema;
      • ParameterOtherSchema -> ParamOtherSchema;
      • ParameterLocation -> ParamLocation;
      • SchemaCommon -> ParamSchema;
      • parameter* fields renamed to param* fields;
      • schemaCommon* fields renamed to paramSchema* fields;
      • HasSchemaCommon -> HasParamSchema.
  • Minor changes:

    • Replace TH-generated JSON instances with Generic-based (see #25);
    • Drop template-haskell dependency;
    • Omit empty array/object properties from toJSON output (#22);
    • Remove minLength property from schemas for time types;
    • Move SchemaOptions to Data.Swagger.SchemaOptions;
    • Remove useReferences from SchemaOptions (see #23);
    • Place all internal submodules under Data.Swagger.Internal;
    • Better documentation (see #26).

0.4.1

  • Fixes:
    • Use PackageImports for Data.HashSet to avoid test failure on stackage (see #15);
    • Add an upper version bound for aeson due to aeson-0.10.0.0 bug (see bos/aeson#293);
    • Switch to Cabal-based multi GHC Travis config.

0.4

  • Remove Swagger/swagger prefixes;
  • Add ToSchema type class with default generic implementation;
  • Add configurable generic ToSchema helpers;
  • Add doctest test suite;
  • Fixes:
    • Fix HasSchemaCommon instance for Schema;
    • Change minimum, maximum and multipleOf properties to be any number, not necessarily an integer;
    • Fix all warnings.

0.3

  • Fixes:
    • Fix SwaggerMonoid Text instance;
    • Wrap Bool in Maybe everywhere;
    • These changes make all Data.Swagger Monoid instances obey monoid laws (previously right identity law was broken by some instances).

0.2

  • Add Data.Swagger.Lens;
  • Support references;
  • Fixes:
    • Fix FromJSON SwaggerHost instance;
    • Add missing Maybes for field types;
    • Decode petstore swagger.json successfully.