Adds build script for Swagger JSON conversion
- This change lets us upload Swagger files for testing and validating online. Change-Id: Ifb570e42b29ec8f01889c982b7cd700754a0e5f7
This commit is contained in:
parent
13e4263f81
commit
d4156fe7f8
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ target/
|
|||||||
/generated
|
/generated
|
||||||
/api-quick-start/build/
|
/api-quick-start/build/
|
||||||
/firstapp/build*/
|
/firstapp/build*/
|
||||||
|
swagger/
|
||||||
|
|
||||||
# Packages
|
# Packages
|
||||||
*.egg
|
*.egg
|
||||||
|
@ -10,3 +10,4 @@ sphinx>=1.3,!=1.3b1,<1.4
|
|||||||
openstackdocstheme>=1.2.3
|
openstackdocstheme>=1.2.3
|
||||||
nwdiag
|
nwdiag
|
||||||
sphinxcontrib-nwdiag
|
sphinxcontrib-nwdiag
|
||||||
|
fairy-slipper
|
||||||
|
35
tools/build-api-ref-swagger.sh
Executable file
35
tools/build-api-ref-swagger.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash -xe
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
# fairy-slipper should be installed with test-requirements.txt
|
||||||
|
# Migrate DocBook and WADL files to Swagger JSON
|
||||||
|
|
||||||
|
function convert_to_swagger {
|
||||||
|
if [ ! -d swagger ]; then
|
||||||
|
mkdir swagger
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate JSON
|
||||||
|
find api-ref/src/docbkx/ -name api-ref-\* -type f -exec fairy-slipper-docbkx-to-json -o swagger {} \;
|
||||||
|
|
||||||
|
# Generate Swagger
|
||||||
|
find swagger -name api-ref\*json -type f -exec fairy-slipper-wadl-to-swagger-valid -o swagger {} \;
|
||||||
|
|
||||||
|
# Remove interim JSON files
|
||||||
|
rm -r swagger/api-ref*
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
convert_to_swagger
|
7
tox.ini
7
tox.ini
@ -47,6 +47,11 @@ commands =
|
|||||||
# Build DocBook Guides
|
# Build DocBook Guides
|
||||||
openstack-doc-test --check-build {posargs}
|
openstack-doc-test --check-build {posargs}
|
||||||
|
|
||||||
|
[testenv:makeswagger]
|
||||||
|
commands =
|
||||||
|
# Build Swagger files
|
||||||
|
{toxinidir}/tools/build-api-ref-swagger.sh
|
||||||
|
|
||||||
[testenv:publishdocs]
|
[testenv:publishdocs]
|
||||||
# Prepare documents (without www) so that they can get published on
|
# Prepare documents (without www) so that they can get published on
|
||||||
# docs.openstack.org with just copying publish-docs/* over.
|
# docs.openstack.org with just copying publish-docs/* over.
|
||||||
@ -65,6 +70,8 @@ commands =
|
|||||||
{toxinidir}/tools/build-api-quick-start.sh
|
{toxinidir}/tools/build-api-quick-start.sh
|
||||||
# Build website index
|
# Build website index
|
||||||
{toxinidir}/tools/build-index.sh publish
|
{toxinidir}/tools/build-index.sh publish
|
||||||
|
# Build RST/JSON from fairy-slipper
|
||||||
|
{toxinidir}/tools/build-api-ref-swagger.sh
|
||||||
|
|
||||||
[testenv:checklang]
|
[testenv:checklang]
|
||||||
# openstack-generate-docbook needs xml2po which cannot be installed in
|
# openstack-generate-docbook needs xml2po which cannot be installed in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user