All Projects → marshmallow-code → Apispec

marshmallow-code / Apispec

Licence: mit
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Apispec

Flasgger
Easy OpenAPI specs and Swagger UI for your Flask API
Stars: ✭ 2,825 (+239.95%)
Mutual labels:  api, rest-api, swagger, openapi, openapi-specification, marshmallow, flask
Oas Kit
Convert Swagger 2.0 definitions to OpenAPI 3.0 and resolve/validate/lint
Stars: ✭ 516 (-37.91%)
Mutual labels:  api, swagger, openapi, openapi3, openapi-specification, documentation
Swagger Ui
Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
Stars: ✭ 21,279 (+2460.65%)
Mutual labels:  rest-api, swagger, openapi, openapi3, openapi-specification, hacktoberfest
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+314.92%)
Mutual labels:  api, rest-api, swagger, openapi, openapi3, hacktoberfest
Awesome Openapi3
😎 A list of awesome projects related to OpenAPI 3.0.x, curated by the community
Stars: ✭ 469 (-43.56%)
Mutual labels:  api, swagger, openapi, openapi3, documentation
Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+4663.9%)
Mutual labels:  api, swagger, openapi, json-schema, openapi3
Swagger Parser
Swagger Spec to Java POJOs
Stars: ✭ 468 (-43.68%)
Mutual labels:  rest-api, swagger, openapi, openapi3, openapi-specification
Swagger Combine
Combines multiple Swagger schemas into one dereferenced schema.
Stars: ✭ 102 (-87.73%)
Mutual labels:  api, swagger, openapi, hacktoberfest, documentation
Springdoc Openapi
Library for OpenAPI 3 with spring-boot
Stars: ✭ 1,113 (+33.94%)
Mutual labels:  rest-api, swagger, openapi, openapi3, openapi-specification
Openapi Generator
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
Stars: ✭ 10,634 (+1179.66%)
Mutual labels:  api, rest-api, openapi, openapi3, hacktoberfest
Safrs
SqlAlchemy Flask-Restful Swagger Json:API OpenAPI
Stars: ✭ 255 (-69.31%)
Mutual labels:  rest-api, swagger, openapi, openapi3, flask
Widdershins
OpenAPI / Swagger, AsyncAPI & Semoasa definitions to (re)Slate compatible markdown
Stars: ✭ 856 (+3.01%)
Mutual labels:  api, swagger, openapi, openapi3, documentation
Swagger Js
Javascript library to connect to swagger-enabled APIs via browser or nodejs
Stars: ✭ 2,319 (+179.06%)
Mutual labels:  rest-api, swagger, openapi3, openapi-specification, hacktoberfest
Flask Restplus Server Example
Real-life RESTful server example on Flask-RESTplus
Stars: ✭ 1,240 (+49.22%)
Mutual labels:  rest-api, swagger, openapi, marshmallow, flask
Openapi Diff
Utility for comparing two OpenAPI specifications.
Stars: ✭ 208 (-74.97%)
Mutual labels:  api, swagger, openapi, openapi3, openapi-specification
Openapi Codegen
OpenAPI 3.0 CodeGen plus Node.js minus the Java and emojis
Stars: ✭ 224 (-73.04%)
Mutual labels:  api, swagger, openapi, openapi3, documentation
Swagger Core
Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API
Stars: ✭ 6,898 (+730.08%)
Mutual labels:  rest-api, swagger, openapi, openapi3, openapi-specification
Swagger Editor
Swagger Editor
Stars: ✭ 7,365 (+786.28%)
Mutual labels:  rest-api, swagger, openapi3, openapi-specification, hacktoberfest
Openapi Directory
🌐 Wikipedia for Web APIs. Directory of REST API definitions in OpenAPI 2.0/3.x format
Stars: ✭ 2,635 (+217.09%)
Mutual labels:  api, rest-api, swagger, openapi, openapi3
Kin Openapi
OpenAPI 3.0 implementation for Go (parsing, converting, validation, and more)
Stars: ✭ 776 (-6.62%)
Mutual labels:  api, swagger, openapi, openapi3, documentation

apispec


.. image:: https://badgen.net/pypi/v/apispec :target: https://pypi.org/project/apispec/ :alt: PyPI version

.. image:: https://dev.azure.com/sloria/sloria/_apis/build/status/marshmallow-code.apispec?branchName=dev :target: https://dev.azure.com/sloria/sloria/_build/latest?definitionId=8&branchName=dev :alt: Build status

.. image:: https://readthedocs.org/projects/apispec/badge/ :target: https://apispec.readthedocs.io/ :alt: Documentation

.. image:: https://badgen.net/badge/marshmallow/3?list=1 :target: https://marshmallow.readthedocs.io/en/latest/upgrading.html :alt: marshmallow 3 only

.. image:: https://badgen.net/badge/OAS/2,3?list=1&color=cyan :target: https://github.com/OAI/OpenAPI-Specification :alt: OpenAPI Specification 2/3 compatible

.. image:: https://badgen.net/badge/code%20style/black/000 :target: https://github.com/ambv/black :alt: code style: black

A pluggable API specification generator. Currently supports the OpenAPI Specification <https://github.com/OAI/OpenAPI-Specification>_ (f.k.a. the Swagger specification).

Features

  • Supports the OpenAPI Specification (versions 2 and 3)
  • Framework-agnostic
  • Built-in support for marshmallow <https://marshmallow.readthedocs.io/>_
  • Utilities for parsing docstrings

Example Application

.. code-block:: python

from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
from apispec_webframeworks.flask import FlaskPlugin
from flask import Flask
from marshmallow import Schema, fields


# Create an APISpec
spec = APISpec(
    title="Swagger Petstore",
    version="1.0.0",
    openapi_version="3.0.2",
    plugins=[FlaskPlugin(), MarshmallowPlugin()],
)

# Optional marshmallow support
class CategorySchema(Schema):
    id = fields.Int()
    name = fields.Str(required=True)


class PetSchema(Schema):
    category = fields.List(fields.Nested(CategorySchema))
    name = fields.Str()


# Optional security scheme support
api_key_scheme = {"type": "apiKey", "in": "header", "name": "X-API-Key"}
spec.components.security_scheme("ApiKeyAuth", api_key_scheme)


# Optional Flask support
app = Flask(__name__)


@app.route("/random")
def random_pet():
    """A cute furry animal endpoint.
    ---
    get:
      description: Get a random pet
      security:
        - ApiKeyAuth: []
      responses:
        200:
          content:
            application/json:
              schema: PetSchema
    """
    pet = get_random_pet()
    return PetSchema().dump(pet)


# Register the path and the entities within it
with app.test_request_context():
    spec.path(view=random_pet)

Generated OpenAPI Spec

.. code-block:: python

import json

print(json.dumps(spec.to_dict(), indent=2))
# {
#   "paths": {
#     "/random": {
#       "get": {
#         "description": "Get a random pet",
#         "security": [
#           {
#             "ApiKeyAuth": []
#           }
#         ],
#         "responses": {
#           "200": {
#             "content": {
#               "application/json": {
#                 "schema": {
#                   "$ref": "#/components/schemas/Pet"
#                 }
#               }
#             }
#           }
#         }
#       }
#     }
#   },
#   "tags": [],
#   "info": {
#     "title": "Swagger Petstore",
#     "version": "1.0.0"
#   },
#   "openapi": "3.0.2",
#   "components": {
#     "parameters": {},
#     "responses": {},
#     "schemas": {
#       "Category": {
#         "type": "object",
#         "properties": {
#           "name": {
#             "type": "string"
#           },
#           "id": {
#             "type": "integer",
#             "format": "int32"
#           }
#         },
#         "required": [
#           "name"
#         ]
#       },
#       "Pet": {
#         "type": "object",
#         "properties": {
#           "name": {
#             "type": "string"
#           },
#           "category": {
#             "type": "array",
#             "items": {
#               "$ref": "#/components/schemas/Category"
#             }
#           }
#         }
#       }
#       "securitySchemes": {
#          "ApiKeyAuth": {
#            "type": "apiKey",
#            "in": "header",
#            "name": "X-API-Key"
#         }
#       }
#     }
#   }
# }

print(spec.to_yaml())
# components:
#   parameters: {}
#   responses: {}
#   schemas:
#     Category:
#       properties:
#         id: {format: int32, type: integer}
#         name: {type: string}
#       required: [name]
#       type: object
#     Pet:
#       properties:
#         category:
#           items: {$ref: '#/components/schemas/Category'}
#           type: array
#         name: {type: string}
#       type: object
#   securitySchemes:
#     ApiKeyAuth:
#       in: header
#       name: X-API-KEY
#       type: apiKey
# info: {title: Swagger Petstore, version: 1.0.0}
# openapi: 3.0.2
# paths:
#   /random:
#     get:
#       description: Get a random pet
#       responses:
#         200:
#           content:
#             application/json:
#               schema: {$ref: '#/components/schemas/Pet'}
#       security:
#       - ApiKeyAuth: []
# tags: []

Documentation

Documentation is available at https://apispec.readthedocs.io/ .

Ecosystem

A list of apispec-related libraries can be found at the GitHub wiki here:

https://github.com/marshmallow-code/apispec/wiki/Ecosystem

Support apispec

apispec is maintained by a group of volunteers <https://apispec.readthedocs.io/en/latest/authors.html>_. If you'd like to support the future of the project, please consider contributing to our Open Collective:

.. image:: https://opencollective.com/marshmallow/donate/button.png :target: https://opencollective.com/marshmallow :width: 200 :alt: Donate to our collective

Professional Support

Professionally-supported apispec is available through the Tidelift Subscription <https://tidelift.com/subscription/pkg/pypi-apispec?utm_source=pypi-apispec&utm_medium=referral&utm_campaign=readme>_.

Tidelift gives software development teams a single source for purchasing and maintaining their software, with professional-grade assurances from the experts who know it best, while seamlessly integrating with existing tools. [Get professional support_]

.. _Get professional support: https://tidelift.com/subscription/pkg/pypi-apispec?utm_source=pypi-apispec&utm_medium=referral&utm_campaign=readme

.. image:: https://user-images.githubusercontent.com/2379650/45126032-50b69880-b13f-11e8-9c2c-abd16c433495.png :target: https://tidelift.com/subscription/pkg/pypi-apispec?utm_source=pypi-apispec&utm_medium=referral&utm_campaign=readme :alt: Get supported apispec with Tidelift

Security Contact Information

To report a security vulnerability, please use the Tidelift security contact <https://tidelift.com/security>_. Tidelift will coordinate the fix and disclosure.

Project Links

License

MIT licensed. See the bundled LICENSE <https://github.com/marshmallow-code/apispec/blob/dev/LICENSE>_ file for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].