swagger2

Join the chat at http://gitter-im-s.njmu.s5.bt8.net/haskell-swagger2/Lobby

Hackage Build Status Stackage LTS Stackage Nightly

Swagger 2.0 data model.

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

Usage

This library is intended 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

2.8.9

  • Support GHC 9.10 (see #255)

2.8.8

  • Support GHC 9.8 (see #249);

2.8.7

  • Support extensions on operations (see #245);
  • Support GHC 9.6 (see #246);

2.8.6

  • Support GHC 9.4 (see #244);

2.8.5

  • Add newer dependencies (i.e. aeson, lens, etc.) (see #242);

2.8.4

  • Add GHC 9.2.3 to CI Matrix and bump stack resolver to lts-19.11 (see #237);

2.8.3

  • mtl-2.3 and transformers-0.6 support (see #235, #236);

2.8.2

  • text-2.0 support (see #234);

2.8.1

  • Better error message in validateSchemaType (see #221);

2.8

  • Support GHC 9.2 (see #231, #232, #233);
  • Aeson 2.0.3.0 compatibility (see #230);

2.7

  • Upgrade aeson to 2.0.1.0 (see #228);
  • Switch from Travis CI to GitHub Actions (see #228);
  • GHC 9 support (see #228);
  • More GHC-8.10 related cleanup, tighten lower bound on some dependencies. (see #216);
  • Add “format” field for uint32 and uint64 (see #215);

2.6

  • GHC 8.10 support (see #210);
  • Move aeson-pretty to other dependencies (see #206);
  • Merge OAuth2 scopes (see #151);

2.5

Highlights:

  • Add instance for TimeOfDay (see #196);
  • Add support for optics (see #200);
  • Slightly better validation errors (see #195);

Fixes and minor changes:

  • Minor cleanup (see #194);
  • Allow base-4.13 and other GHC-8.8 related stuff (see #198);
  • Fix stack.yaml (see #201);

2.4

  • Allow hashable-1.3, semigroups-0.19, network-3.1, time-1.9, generics-sop-0.5
  • Tags aren’t sorted (see #165)
  • Schema type is optional (see #138, #164)
  • Take concrete ‘Proxy’ as argument (see #180)
  • GHC-8.8 preparations

2.3.1.1

  • Allow network-3.0

2.3.1

  • Add a quickcheck generator for aeson Values that match a swagger schema (see #162)
  • Add ToParamSchema instance for SetCookie (see #173)
  • Make nullary schemas valid (see #168)

2.3.0.1

  • Support GHC-8.6

2.3

Major changes:

  • Add support for additionalProperties with Bool value (see #159);
  • Add ToSchema Object instance (for aeson’s Object) (see d72466a);

Dependencies and CI:

  • Aeson 1.4 (see #158);
  • Update .travis.yml (see #160);
  • Allow network 2.7 (see #155);
  • Allow lens-4.17 (see #161);

2.2.2

  • Add ToSchema Version instance
  • Use base-compat-batteries (0.10)
  • PVP bounds

2.2.1

  • Add Semigroup instances
  • GHC-8.4 compatibility
  • `Schema (NonEmpty a) instance (see #141)
  • Fix optional property for unary records (see #142)
  • Add fromAesonOptions helper (see #146)
  • Fix non-termination when using datatypeNameModifier with recursive data types (see #132)

2.2

  • Treat unknown properties as validation errors in validateToJSON (see #126);
  • Add validateJSON and validateJSONWithPatternChecker to validate JSON Value against Schema without classes (see #126);
  • Add more Schema helpers (see #126):
    • genericNameSchema — to give a custom schema Generic-based name;
    • genericDeclareNamedSchemaNewtype — to derive NamedSchema for newtypes;
    • declareSchemaBoundedEnumKeyMapping — to derive more specific Schema for maps with Bounded Enum keys;
  • Add a few tests with invalid Schema.

2.1.6

  • Add ToParamSchema and ToSchema instances for Fixed (see #121) and Natural (see #123);
  • Fix instance for NominalDiffTime (see #121);
  • Fix build for aeson-1.2.2.0 (see #125).

2.1.5

  • Type error by default when deriving Generic-based instances for mixed sum types (see #118);
  • Adjust allOf to accept referenced schemas (see #119);
  • Add instances for Identity (see #116);
  • Add Gitter chat badge (see #114).

2.1.4.1

  • GHC-8.2 support (see #95, #106 and #108);
  • Documentation corrections (see #105);
  • Allow generics-sop-0.3 (see #102);
  • Fix ToSchema example in docs (see #104).

2.1.4

  • Add liftDeclare (see #100);
  • Add MonadDeclare instances for all monad transformers (see #100).

2.1.3

  • Add UUID instances (see #81).
  • Add TypeError ToSchema and ToParamSchema ByteString instances (see #78)
  • Improve documentation for generic sum type instance derivation (see #75)
  • Compile warning free (see #82)

2.1.2.1

  • Bug fix previous release

2.1.2

  • Minor changes:
    • Support aeson-1.0.0.0 (see #70).

2.1.1

  • Minor changes:
    • Proper Schema examples for Char, Day, LocalTime, ZonedTime and UTCTime.

2.1

  • Major changes:
    • Use InsOrdHashMap to preserve insertion order for endpoints and definitions (see #56);
    • Add support for GHC 8.0 (see #65).

2.0.2

  • Fixes:
    • Fix additionalProperties to allow references;
    • Fix ToSchema instances for Map and HashMap (prevent infinite recursion for recursive values).

2.0.1

  • Fixes:
    • Re-export Pattern synonym from Data.Swagger;
    • Documentation fixes.

2.0

  • Major changes:

    • GHC 7.8 support (see #49);
    • Switch to classy field lenses (see #41);
    • Add Data.Swagger.Schema.Validation (see #18);
    • Add Data.Swagger.Operation with helpers (see #50);
    • Add IsString instances for some types (see #47);
    • Add helpers to sketch Schema from JSON (see #48).
  • Minor changes:

    • Make NamedSchema a data rather than type (see #42);
    • Change Definitions to Definitions Schema;
    • Add schema templates for "binary", "byte" and "password" formats (see 63ed597);
    • Add Monoid instance for Contact;
    • Change tags to be Set rather than list.
  • Fixes:

    • Fix schema for () and nullary constructors (see ab65c4a);
    • Fix Operation FromJSON instance to allow missing tags and parameters properties.

1.2.1

  • Minor changes:

    • Change _SwaggerItemsPrimitive type from a Prism' to a more restrictive Review-like Optic'.
  • Fixes:

    • Fix build for GHC 8.0-rc1.

1.2

  • Minor changes (see #36):

    • Change default ToSchema instance for unit data types (i.e. types with one nullable constructor like data Unit = Unit): now these types are treated like sum types with only one alternative