]
},
{
- "owner": "pdns-swagger",
+ "owner": "pdns-openapi",
"severity": "error",
"pattern": [
{
- "regexp": "(docs/http-api/swagger/.*\\.yaml)$",
+ "regexp": "(docs/http-api/openapi/.*\\.yaml)$",
"file": 1
},
{
^codedocs/doxygen\.conf$
^docs/depfile\.py$
^docs/http-api/tsigkey\.rst$
-^docs/http-api/swagger/spectral-ruleset\.yaml$
+^docs/http-api/openapi/spectral-ruleset\.yaml$
^docs/lua-records/reference/index\.rst$
^modules/remotebackend/example\.rb$
^modules/remotebackend/test-remotebackend-keys\.hh$
allow-empty: true
fail-on-error: false
- swagger-syntax-check:
+ openapi-syntax-check:
if: ${{ (!github.event.schedule || vars.SCHEDULED_JOBS_BUILD_AND_TEST_ALL) && ! contains(needs.get-runner-container-image.outputs.id, 'debian-11') }}
runs-on: ubuntu-24.04
needs:
with:
venv-parent: ${{ env.REPO_HOME }}
working-directory: .
- - run: ${{ env.INV_CMD }} install-swagger-tools
- - run: ${{ env.INV_CMD }} swagger-syntax-check
+ - run: ${{ env.INV_CMD }} install-openapi-tools
+ - run: ${{ env.INV_CMD }} openapi-syntax-check
collect:
needs:
- build-auth
- build-dnsdist
- build-recursor
- - swagger-syntax-check
+ - openapi-syntax-check
- test-auth-api
- test-auth-backend
- test-dnsdist-regression
PDNS_CHECK_PYTHON_VENV
-AM_CONDITIONAL([HAVE_API_SWAGGER_JSON], [test -e "$srcdir/pdns/api-swagger.json"])
-AM_COND_IF([HAVE_API_SWAGGER_JSON],[],[
+AM_CONDITIONAL([HAVE_API_OPENAPI_JSON], [test -e "$srcdir/pdns/api-openapi.json"])
+AM_COND_IF([HAVE_API_OPENAPI_JSON],[],[
AM_COND_IF([HAVE_VENV],[],[
AC_MSG_ERROR([Python 3 and/or venv module are not available, Authoritative Server cannot be built.])
])
/mans
/mans.tmp
/_build
-/http-api/swagger/authoritative-api-schema.yaml
+/http-api/openapi/authoritative-api-schema.yaml
/sphinx.d
/sphinx.stamp
EXTRA_DIST = \
$(MANPAGES_DIST) \
- http-api/swagger/authoritative-api-swagger.yaml
+ http-api/openapi/authoritative-api-openapi.yaml
if HAVE_VENV
if !HAVE_MANPAGES
endif
rm -rf mans
-http-api/swagger/authoritative-api-schema.yaml: .venv generate-jsonschema.py http-api/swagger/authoritative-api-swagger.yaml
- .venv/bin/python ./generate-jsonschema.py http-api/swagger/authoritative-api-swagger.yaml $@
+http-api/openapi/authoritative-api-schema.yaml: .venv generate-jsonschema.py http-api/openapi/authoritative-api-openapi.yaml
+ .venv/bin/python ./generate-jsonschema.py http-api/openapi/authoritative-api-openapi.yaml $@
-html-docs: common/** manpages/** .venv *.rst http-api/swagger/authoritative-api-schema.yaml
+html-docs: common/** manpages/** .venv *.rst http-api/openapi/authoritative-api-schema.yaml
.venv/bin/python -msphinx -b html . html-docs
-latex/PowerDNS-Authoritative.pdf: common/** manpages/** .venv *.rst http-api/swagger/authoritative-api-schema.yaml
+latex/PowerDNS-Authoritative.pdf: common/** manpages/** .venv *.rst http-api/openapi/authoritative-api-schema.yaml
.venv/bin/python -msphinx -M latexpdf . .
PowerDNS-Authoritative.pdf: latex/PowerDNS-Authoritative.pdf
help: .venv
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
-.PHONY: help Makefile.sphinx generate-jsonschema.py http-api/swagger/authoritative-api-swagger.yaml
+.PHONY: help Makefile.sphinx generate-jsonschema.py http-api/openapi/authoritative-api-openapi.yaml
-http-api/swagger/authoritative-api-schema.yaml: .venv generate-jsonschema.py http-api/swagger/authoritative-api-swagger.yaml
- .venv/bin/python ./generate-jsonschema.py http-api/swagger/authoritative-api-swagger.yaml $@
+http-api/openapi/authoritative-api-schema.yaml: .venv generate-jsonschema.py http-api/openapi/authoritative-api-openapi.yaml
+ .venv/bin/python ./generate-jsonschema.py http-api/openapi/authoritative-api-openapi.yaml $@
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
-%: Makefile.sphinx .venv http-api/swagger/authoritative-api-schema.yaml
+%: Makefile.sphinx .venv http-api/openapi/authoritative-api-schema.yaml
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.venv:
changelog_hide_tags_in_entry = True
# -- Options for the Sphinx-Immaterial JSON Domain ------------------------
-json_schemas = ["http-api/swagger/authoritative-api-schema.yaml"]
+json_schemas = ["http-api/openapi/authoritative-api-schema.yaml"]
# -- Options for the HTTP Domain ------------------------
# Because we use 'default' in the OpenAPI definition for responses, the HTTP domain
{
"name": "PowerDNS Authoritative API",
"page": "http-api/redoc",
- "spec": "http-api/swagger/authoritative-api-swagger.yaml",
+ "spec": "http-api/openapi/authoritative-api-openapi.yaml",
"embed": True,
"opts": {
"native-scrollbars": True,
Autoprimary endpoints
---------------------
-.. openapi:: swagger/authoritative-api-swagger.yaml
+.. openapi:: openapi/authoritative-api-openapi.yaml
:paths: /servers/{server_id}/autoprimaries /servers/{server_id}/autoprimaries/{ip}/{nameserver}
:examples:
Endpoints
---------
-.. openapi:: swagger/authoritative-api-swagger.yaml
+.. openapi:: openapi/authoritative-api-openapi.yaml
:paths: /servers/{server_id}/cache/flush
:examples:
Endpoints
---------
-.. openapi:: swagger/authoritative-api-swagger.yaml
+.. openapi:: openapi/authoritative-api-openapi.yaml
:paths: /servers/{server_id}/zones/{zone_id}/cryptokeys /servers/{server_id}/zones/{zone_id}/cryptokeys/{cryptokey_id}
:examples:
This chapter describes the PowerDNS Authoritative API.
When creating an API wrapper (for instance when fronting multiple API's), it is recommended to stick to this API specification.
-The API is described in the `OpenAPI format <https://www.openapis.org/>`_, also known as "Swagger", and this description is `available <https://raw.githubusercontent.com/PowerDNS/pdns/master/docs/http-api/swagger/authoritative-api-swagger.yaml>`_. It can also be obtained from a running server if the administrator of that server has enabled the API; it
-is available at the `/api/docs` endpoint in both YAML and JSON formats (the 'Accept' header can be used to indicate the
+The API is described in the `OpenAPI 3.1 format <https://www.openapis.org/>`_, and this description is `available <https://raw.githubusercontent.com/PowerDNS/pdns/master/docs/http-api/openapi/authoritative-api-openapi.yaml>`_. It can also be obtained from a running server if the administrator of that server has enabled the API; it
+is available at the `/api/docs` endpoint in both YAML and JSON formats (the 'Accept' header can be used to indicate the
desired format).
Authentication
Endpoints
---------
-.. openapi:: swagger/authoritative-api-swagger.yaml
+.. openapi:: openapi/authoritative-api-openapi.yaml
:paths: /servers/{server_id}/zones/{zone_id}/metadata /servers/{server_id}/zones/{zone_id}/metadata/{metadata_kind}
:examples:
Networks Endpoints
------------------
-.. openapi:: swagger/authoritative-api-swagger.yaml
+.. openapi:: openapi/authoritative-api-openapi.yaml
:paths: /servers/{server_id}/networks /servers/{server_id}/networks/{ip}/{prefixlen}
:examples:
Endpoints
---------
-.. openapi:: swagger/authoritative-api-swagger.yaml
+.. openapi:: openapi/authoritative-api-openapi.yaml
:paths: /servers/{server_id}/search-data
:examples:
Endpoints
---------
-.. openapi:: swagger/authoritative-api-swagger.yaml
+.. openapi:: openapi/authoritative-api-openapi.yaml
:paths: /servers /servers/{server_id}
:examples:
Endpoints
---------
-.. openapi:: swagger/authoritative-api-swagger.yaml
+.. openapi:: openapi/authoritative-api-openapi.yaml
:paths: /servers/{server_id}/statistics
:examples:
TSIGKey Endpoints
-----------------
-.. openapi:: swagger/authoritative-api-swagger.yaml
+.. openapi:: openapi/authoritative-api-openapi.yaml
:paths: /servers/{server_id}/tsigkeys /servers/{server_id}/tsigkeys/{tsigkey_id}
:examples:
Views Endpoints
---------------
-.. openapi:: swagger/authoritative-api-swagger.yaml
+.. openapi:: openapi/authoritative-api-openapi.yaml
:paths: /servers/{server_id}/views /servers/{server_id}/views/{view} /servers/{server_id}/views/{view}/{id}
:examples:
Zone Endpoints
--------------
-.. openapi:: swagger/authoritative-api-swagger.yaml
+.. openapi:: openapi/authoritative-api-openapi.yaml
:paths: /servers/{server_id}/zones /servers/{server_id}/zones/{zone_id} /servers/{server_id}/zones/{zone_id}/axfr-retrieve /servers/{server_id}/zones/{zone_id}/notify /servers/{server_id}/zones/{zone_id}/export /servers/{server_id}/zones/{zone_id}/rectify
:examples:
- "autoreconf -vi"
- "./configure --with-modules='bind gsqlite3 gmysql gpgsql ldap'"
- "pushd pdns"
- - "touch .venv api-swagger.yaml api-swagger.json"
+ - "touch .venv api-openapi.yaml api-openapi.json"
- "popd"
index:
build_command:
libpdns_dnslabeltext_gen = ragel_generator.process(libpdns_dnslabeltext_source)
endif
-libpdns_apidocfiles_source = 'docs' / 'http-api' / 'swagger' / 'authoritative-api-swagger.yaml'
+libpdns_apidocfiles_source = 'docs' / 'http-api' / 'openapi' / 'authoritative-api-openapi.yaml'
libpdns_apidocfiles_gen = src_dir / 'apidocfiles.h'
-generate_api_swagger_py = src_dir / 'generate-api-swagger.py'
+generate_api_openapi_py = src_dir / 'generate-api-openapi.py'
if not fs.is_file(libpdns_apidocfiles_gen)
py = import('python')
python = py.find_installation('python3', modules: 'yaml', required: true)
- summary('Python', python.found(), bool_yn: true, section: 'Swagger API')
- summary('Path', python.full_path(), section: 'Swagger API')
- summary('Version', python.version(), section: 'Swagger API')
+ summary('Python', python.found(), bool_yn: true, section: 'Openapi API')
+ summary('Path', python.full_path(), section: 'Openapi API')
+ summary('Version', python.version(), section: 'Openapi API')
libpdns_apidocfiles_gen = custom_target(
'pdns-apidocfiles-h',
command: [python, '@INPUT0@', '@INPUT1@'],
- input: [generate_api_swagger_py, libpdns_apidocfiles_source],
+ input: [generate_api_openapi_py, libpdns_apidocfiles_source],
output: 'apidocfiles.h',
capture: true,
)
if python.found()
json_schema = custom_target(
'auth-json-schema',
- input: product_source_dir / docs_dir / 'http-api' / 'swagger' / 'authoritative-api-swagger.yaml',
+ input: product_source_dir / docs_dir / 'http-api' / 'openapi' / 'authoritative-api-openapi.yaml',
output: 'auth-schema-generated.stamp',
command: [
python,
product_source_dir / docs_dir / 'generate-jsonschema.py',
'@INPUT@',
- product_source_dir / docs_dir / 'http-api' / 'swagger' / 'authoritative-api-schema.yaml',
+ product_source_dir / docs_dir / 'http-api' / 'openapi' / 'authoritative-api-schema.yaml',
'--stampfile',
'@OUTPUT@'
],
/calidns
/dumresp
/apidocfiles.h
-/api-swagger.yaml
-/api-swagger.json
+/api-openapi.yaml
+/api-openapi.json
/.venv
-/.swagger-api-venv
+/.openapi-api-venv
effective_tld_names.dat
/dnsmessage.pb.cc
/dnsmessage.pb.h
endif
EXTRA_DIST = \
- api-swagger.json \
- api-swagger.yaml \
+ api-openapi.json \
+ api-openapi.yaml \
bindparser.hh \
convert-yaml-to-json.py \
dnslabeltext.cc \
dnslabeltext.rl \
dnsmessage.proto \
- generate-api-swagger.py \
+ generate-api-openapi.py \
incfiles \
inflighter.cc \
ixfrdist.example.yml \
pdns.conf-dist \
apidocfiles.h
-if !HAVE_API_SWAGGER_JSON
+if !HAVE_API_OPENAPI_JSON
# don't clean these files if they were present
# at 'configure' time (e.g. from a source dist)
CLEANFILES += \
- api-swagger.yaml \
- api-swagger.json
+ api-openapi.yaml \
+ api-openapi.json
endif
# use a $(wildcard) wrapper here to allow build to proceed if output
# file is present but input file is not (e.g. in a dist tarball)
-api-swagger.yaml: $(wildcard ${srcdir}/../docs/http-api/swagger/authoritative-api-swagger.yaml)
+api-openapi.yaml: $(wildcard ${srcdir}/../docs/http-api/openapi/authoritative-api-openapi.yaml)
cp $< $@
if HAVE_VENV
-api-swagger.json: api-swagger.yaml requirements.txt
+api-openapi.json: api-openapi.yaml requirements.txt
$(PYTHON) -m venv .venv
.venv/bin/pip install -U pip "setuptools<82"
.venv/bin/pip install -r ${srcdir}/requirements.txt
.venv/bin/python ${srcdir}/convert-yaml-to-json.py $< $@
else # if HAVE_VENV
-if !HAVE_API_SWAGGER_JSON
-api-swagger.json:
+if !HAVE_API_OPENAPI_JSON
+api-openapi.json:
echo "You need Python 3 and the 'venv' module to generate the JSON API document"
exit 1
endif
endif
-apidocfiles.h: api-swagger.yaml api-swagger.json
+apidocfiles.h: api-openapi.yaml api-openapi.json
$(AM_V_GEN)$(srcdir)/incfiles $^ > $@.tmp
@mv $@.tmp $@
-"""Produce API swagger YAML and JSON representations usable from C."""
+"""Produce API OpenAPI YAML and JSON representations usable from C."""
import json
import sys
print(header)
print()
- dump_hex(yaml_contents, "api_swagger_yamlData", "g_api_swagger_yaml")
+ dump_hex(yaml_contents, "api_openapi_yamlData", "g_api_openapi_yaml")
print()
print("// -----------------------------------------------------------")
print()
- dump_hex(json_contents, "api_swagger_jsonData", "g_api_swagger_json")
+ dump_hex(json_contents, "api_openapi_jsonData", "g_api_openapi_json")
help: .venv
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
-.PHONY: help Makefile.sphinx generate-jsonschema.py http-api/authoritative-api-swagger.yaml
+.PHONY: help Makefile.sphinx generate-jsonschema.py http-api/authoritative-api-openapi.yaml
-http-api/recursor-generated-schema.yaml: .venv generate-jsonschema.py http-api/authoritative-api-swagger.yaml
- .venv/bin/python ./generate-jsonschema.py http-api/authoritative-api-swagger.yaml $@
+http-api/recursor-generated-schema.yaml: .venv generate-jsonschema.py http-api/authoritative-api-openapi.yaml
+ .venv/bin/python ./generate-jsonschema.py http-api/authoritative-api-openapi.yaml $@
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
--- /dev/null
+../../../../docs/http-api/openapi/authoritative-api-openapi.yaml
\ No newline at end of file
+++ /dev/null
-../../../../docs/http-api/swagger/authoritative-api-swagger.yaml
\ No newline at end of file
command: [
python,
product_source_dir / docs_dir / 'generate-jsonschema.py',
- product_source_dir / docs_dir / 'http-api' / 'authoritative-api-swagger.yaml',
+ product_source_dir / docs_dir / 'http-api' / 'authoritative-api-openapi.yaml',
product_source_dir / docs_dir / 'http-api' / 'recursor-generated-schema.yaml',
'--stampfile',
'@OUTPUT@'
void apiDocs(HttpRequest* req, HttpResponse* resp)
{
if (req->accept_yaml) {
- resp->setYamlBody(g_api_swagger_yaml);
+ resp->setYamlBody(g_api_openapi_yaml);
}
else if (req->accept_json) {
- resp->setJsonBody(g_api_swagger_json);
+ resp->setJsonBody(g_api_openapi_json);
}
else {
- resp->setPlainBody(g_api_swagger_yaml);
+ resp->setPlainBody(g_api_openapi_yaml);
}
}
@task
-def install_swagger_tools(c):
+def install_openapi_tools(c):
c.run("sudo apt-get update && sudo apt-get install -y npm")
c.run("sudo mkdir -p /usr/local/lib/node_modules && sudo chmod 777 /usr/local/lib/node_modules")
c.run("npm install -g @stoplight/spectral-cli")
@task
-def swagger_syntax_check(c):
+def openapi_syntax_check(c):
c.run(
- "spectral lint --ruleset docs/http-api/swagger/spectral-ruleset.yaml --fail-severity error --display-only-failures docs/http-api/swagger/authoritative-api-swagger.yaml"
+ "spectral lint --ruleset docs/http-api/openapi/spectral-ruleset.yaml --fail-severity error --display-only-failures docs/http-api/openapi/authoritative-api-openapi.yaml"
)