From 388988f115ea1b813d6c77fb2f01cbae6ea5d836 Mon Sep 17 00:00:00 2001 From: chris48s Date: Sun, 10 Sep 2023 16:45:13 +0100 Subject: [PATCH] WIP migrate docker from examples to openApi --- .../docker/docker-cloud-automated.service.js | 27 ++++++++++++------- services/docker/docker-cloud-build.service.js | 27 ++++++++++++------- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/services/docker/docker-cloud-automated.service.js b/services/docker/docker-cloud-automated.service.js index f808cea3b686a..7453ac8b75851 100644 --- a/services/docker/docker-cloud-automated.service.js +++ b/services/docker/docker-cloud-automated.service.js @@ -1,21 +1,28 @@ -import { BaseJsonService } from '../index.js' +import { BaseJsonService, pathParams } from '../index.js' import { dockerBlue, buildDockerUrl } from './docker-helpers.js' import { fetchBuild } from './docker-cloud-common-fetch.js' export default class DockerCloudAutomatedBuild extends BaseJsonService { static category = 'build' static route = buildDockerUrl('cloud/automated') - static examples = [ - { - title: 'Docker Cloud Automated build', - documentation: '

For the new Docker Hub (https://cloud.docker.com)

', - namedParams: { - user: 'jrottenberg', - repo: 'ffmpeg', + static openApi = { + '/docker/cloud/automated/{user}/{repo}': { + get: { + summary: 'Docker Cloud Automated build', + description: '

For the new Docker Hub (https://cloud.docker.com)

', + parameters: pathParams( + { + name: 'user', + example: 'jrottenberg', + }, + { + name: 'repo', + example: 'ffmpeg', + }, + ), }, - staticPreview: this.render({ buildSettings: ['test'] }), }, - ] + } static _cacheLength = 14400 diff --git a/services/docker/docker-cloud-build.service.js b/services/docker/docker-cloud-build.service.js index 3435dbf3e6adc..21ce4d9d3ca51 100644 --- a/services/docker/docker-cloud-build.service.js +++ b/services/docker/docker-cloud-build.service.js @@ -1,21 +1,28 @@ -import { BaseJsonService, NotFound } from '../index.js' +import { BaseJsonService, NotFound, pathParams } from '../index.js' import { dockerBlue, buildDockerUrl } from './docker-helpers.js' import { fetchBuild } from './docker-cloud-common-fetch.js' export default class DockerCloudBuild extends BaseJsonService { static category = 'build' static route = buildDockerUrl('cloud/build') - static examples = [ - { - title: 'Docker Cloud Build Status', - documentation: '

For the new Docker Hub (https://cloud.docker.com)

', - namedParams: { - user: 'jrottenberg', - repo: 'ffmpeg', + static openApi = { + '/docker/cloud/build/{user}/{repo}': { + get: { + summary: 'Docker Cloud Build Status', + description: '

For the new Docker Hub (https://cloud.docker.com)

', + parameters: pathParams( + { + name: 'user', + example: 'jrottenberg', + }, + { + name: 'repo', + example: 'ffmpeg', + }, + ), }, - staticPreview: this.render({ state: 'Success' }), }, - ] + } static defaultBadgeData = { label: 'docker build' }