diff --git a/.dockerignore b/.dockerignore index 819f8c01..5e31ad1f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,7 +2,7 @@ # do not add /binaries, since it is needed by Docker images /tmp /coverage*.txt -/apidocs/*.html +/api/*.html /internal/core/VERSION /internal/servers/hls/hls.min.js /internal/staticsources/rpicamera/mtxrpicam_*/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 094be25a..c3c9b493 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -170,9 +170,9 @@ jobs: - run: make apidocs - - run: mv apidocs/*.html apidocs/index.html + - run: mv api/*.html api/index.html - uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./apidocs + publish_dir: ./api diff --git a/.gitignore b/.gitignore index db4976ac..e2a09ccf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /tmp /binaries /coverage*.txt -/apidocs/*.html +/api/*.html /internal/core/VERSION /internal/servers/hls/hls.min.js /internal/staticsources/rpicamera/mtxrpicam_*/ diff --git a/README.md b/README.md index ebbd48ab..5d3efd83 100644 --- a/README.md +++ b/README.md @@ -2146,7 +2146,7 @@ To obtain a list of of active paths, run: curl http://127.0.0.1:9997/v3/paths/list ``` -Full documentation of the Control API is available on the [dedicated site](https://bluenviron.github.io/mediamtx/). +The control API is documented in the [OpenAPI / Swagger file](api/openapi.yaml) and in a [dedicated site](https://bluenviron.github.io/mediamtx/). Be aware that by default the Control API is accessible by localhost only; to increase visibility or add authentication, check [Authentication](#authentication). diff --git a/apidocs/openapi.yaml b/api/openapi.yaml similarity index 100% rename from apidocs/openapi.yaml rename to api/openapi.yaml diff --git a/internal/testapidocs/apidocs_test.go b/internal/testapidocs/apidocs_test.go index 9d0352ed..c8c991e8 100644 --- a/internal/testapidocs/apidocs_test.go +++ b/internal/testapidocs/apidocs_test.go @@ -33,7 +33,7 @@ type openAPI struct { } func TestAPIDocs(t *testing.T) { - byts, err := os.ReadFile("../../apidocs/openapi.yaml") + byts, err := os.ReadFile("../../api/openapi.yaml") require.NoError(t, err) var doc openAPI diff --git a/scripts/apidocs.mk b/scripts/apidocs.mk index 95ad089f..b4728f53 100644 --- a/scripts/apidocs.mk +++ b/scripts/apidocs.mk @@ -6,5 +6,5 @@ export DOCKERFILE_APIDOCS_GEN apidocs: echo "$$DOCKERFILE_APIDOCS_GEN" | docker build . -f - -t temp - docker run --rm -v "$(shell pwd)/apidocs:/s" -w /s temp \ + docker run --rm -v "$(shell pwd)/api:/s" -w /s temp \ sh -c "redoc-cli bundle openapi.yaml" diff --git a/scripts/lint.mk b/scripts/lint.mk index bf91bb79..99981f1d 100644 --- a/scripts/lint.mk +++ b/scripts/lint.mk @@ -15,7 +15,7 @@ lint-mod-tidy: lint-apidocs: echo "$$DOCKERFILE_APIDOCS_LINT" | docker build . -f - -t temp - docker run --rm -v "$(shell pwd)/apidocs:/s" -w /s temp \ + docker run --rm -v "$(shell pwd)/api:/s" -w /s temp \ sh -c "openapi lint openapi.yaml" lint: lint-golangci lint-mod-tidy lint-apidocs