Skip to content

Latest commit

 

History

History
39 lines (33 loc) · 775 Bytes

README.md

File metadata and controls

39 lines (33 loc) · 775 Bytes

swaggyp

Python library for generating Swagger API templates

Install

pip install swaggyp

Example

import swaggyp as sw

info = sw.Info(title='Capless',description='Test site',version='dev')
rsp = sw.Response(status_code=200,description='test')
op = sw.Operation(http_method='GET',summary='Test',description='test',responses=[rsp])
p = sw.Path(endpoint='/dev/',operations=[op])
t = sw.SwaggerTemplate(host='capless.io',basePath='/',info=info,paths=[p],schemes=['https'])

>>t.to_yaml()
basePath: /
host: capless.io
info:
  description: Test site
  title: Capless
  version: dev
paths:
  /dev/:
    GET:
      description: test
      responses:
        '200':
          description: test
      summary: Test
schemes:
- https
swagger: '2.0'