mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
move swagger doc metadata out of the awx repo
This commit is contained in:
parent
6cb6c61e5c
commit
fe02abe630
@ -1,44 +0,0 @@
|
||||
---
|
||||
# Add categories here for generated Swagger docs; order will be respected
|
||||
# in the generated document.
|
||||
categories:
|
||||
- name: Versioning
|
||||
- name: Authentication
|
||||
- name: Instances
|
||||
- name: Instance Groups
|
||||
- name: System Configuration
|
||||
- name: Settings
|
||||
- name: Dashboard
|
||||
- name: Organizations
|
||||
- name: Users
|
||||
- name: Projects
|
||||
- name: Project Updates
|
||||
- name: Teams
|
||||
- name: Credentials
|
||||
- name: Credential Types
|
||||
- name: Inventories
|
||||
- name: Custom Inventory Scripts
|
||||
- name: Inventory Sources
|
||||
- name: Inventory Updates
|
||||
- name: Groups
|
||||
- name: Hosts
|
||||
- name: Job Templates
|
||||
- name: Jobs
|
||||
- name: Job Events
|
||||
- name: Job Host Summaries
|
||||
- name: Ad Hoc Commands
|
||||
- name: Ad Hoc Command Events
|
||||
- name: System Job Templates
|
||||
- name: System Jobs
|
||||
- name: Schedules
|
||||
- name: Roles
|
||||
- name: Notification Templates
|
||||
- name: Notifications
|
||||
- name: Labels
|
||||
- name: Unified Job Templates
|
||||
- name: Unified Jobs
|
||||
- name: Activity Streams
|
||||
- name: Workflow Job Templates
|
||||
- name: Workflow Jobs
|
||||
- name: Workflow Job Template Nodes
|
||||
- name: Workflow Job Nodes
|
||||
@ -1 +0,0 @@
|
||||
The Ansible Tower API Reference Manual provides in-depth documentation for Tower's REST API, including examples on how to integrate with it.
|
||||
@ -1,6 +1,4 @@
|
||||
import json
|
||||
import yaml
|
||||
import os
|
||||
import re
|
||||
|
||||
from django.conf import settings
|
||||
@ -12,18 +10,9 @@ from coreapi.compat import force_bytes
|
||||
from openapi_codec.encode import generate_swagger_object
|
||||
import pytest
|
||||
|
||||
import awx
|
||||
from awx.api.versioning import drf_reverse
|
||||
|
||||
|
||||
config_dest = os.sep.join([
|
||||
os.path.realpath(os.path.dirname(awx.__file__)),
|
||||
'api', 'templates', 'swagger'
|
||||
])
|
||||
config_file = os.sep.join([config_dest, 'config.yml'])
|
||||
description_file = os.sep.join([config_dest, 'description.md'])
|
||||
|
||||
|
||||
class i18nEncoder(DjangoJSONEncoder):
|
||||
def default(self, obj):
|
||||
if isinstance(obj, Promise):
|
||||
@ -62,21 +51,6 @@ class TestSwaggerGeneration():
|
||||
data['schemes'] = ['https']
|
||||
data['consumes'] = ['application/json']
|
||||
|
||||
# Inject a top-level description into the OpenAPI document
|
||||
if os.path.exists(description_file):
|
||||
with open(description_file, 'r') as f:
|
||||
data['info']['description'] = f.read()
|
||||
|
||||
# Write tags in the order we want them sorted
|
||||
if os.path.exists(config_file):
|
||||
with open(config_file, 'r') as f:
|
||||
config = yaml.load(f.read())
|
||||
for category in config.get('categories', []):
|
||||
tag = {'name': category['name']}
|
||||
if 'description' in category:
|
||||
tag['description'] = category['description']
|
||||
data.setdefault('tags', []).append(tag)
|
||||
|
||||
revised_paths = {}
|
||||
deprecated_paths = data.pop('deprecated_paths', [])
|
||||
for path, node in data['paths'].items():
|
||||
@ -108,7 +82,6 @@ class TestSwaggerGeneration():
|
||||
# Make some basic assertions about the rendered JSON so we can
|
||||
# be sure it doesn't break across DRF upgrades and view/serializer
|
||||
# changes.
|
||||
assert len(JSON['tags'])
|
||||
assert len(JSON['paths'])
|
||||
|
||||
# The number of API endpoints changes over time, but let's just check
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user