I am trying to create a basic web app without a database and i keep getting a error openapi.spec.exceptions.InvalidSpecException: Missing tag "Index" description
Any idea what is wrong, hopefully I am just missing something.
thughes@krypton [0] $ python example.py --verbose serve
======== Running on http://0.0.0.0:8080 ========
(Press CTRL+C to quit)
Error handling request
Traceback (most recent call last):
File "/home/thughes/.local/share/virtualenvs/xopenapi-1bFmqCwq/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
resp = await task
File "/home/thughes/.local/share/virtualenvs/xopenapi-1bFmqCwq/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
resp = await handler(request)
File "/home/thughes/.local/share/virtualenvs/xopenapi-1bFmqCwq/lib/python3.7/site-packages/openapi/spec/spec.py", line 435, in spec_root
app['spec_doc'] = app['spec'].build(app)
File "/home/thughes/.local/share/virtualenvs/xopenapi-1bFmqCwq/lib/python3.7/site-packages/openapi/spec/spec.py", line 239, in build
self._build_paths(app, public, private)
File "/home/thughes/.local/share/virtualenvs/xopenapi-1bFmqCwq/lib/python3.7/site-packages/openapi/spec/spec.py", line 284, in _build_paths
self._validate_tags()
File "/home/thughes/.local/share/virtualenvs/xopenapi-1bFmqCwq/lib/python3.7/site-packages/openapi/spec/spec.py", line 292, in _validate_tags
f'Missing tag "{tag_name}" description'
openapi.spec.exceptions.InvalidSpecException: Missing tag "Index" description
INFO: openapi: 127.0.0.1 [04/Mar/2019:22:53:25 +0000] "GET /v1/spec HTTP/1.1" 500 334 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0"
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
from aiohttp import web
from openapi.rest import rest
from openapi.spec import op
from openapi.spec.path import ApiPath
def create_app():
return rest(
openapi=dict(
title='A REST API',
),
base_path='/v1',
allowed_tags=[],
validate_docs=True,
setup_app=setup_app,
commands=[]
)
def setup_app(app):
app.router.add_routes([
web.view('/', Index)
])
return app
class Index(ApiPath):
"""
---
summary: Index
description: Index page
tags:
- Index
"""
@op()
async def index(self):
"""
---
summary: Get Index
description: Displays the Index
responses:
200:
description: Index page
"""
return {}
if __name__ == '__main__':
create_app().main()
As a side note, having a bunch of working examples would be very useful. Feel free to use this one once it is working.