migrate examples to openApi part 18; affects [conda feedz gem openvsx readthedocs] github (#9607)
* migrate some services from examples to openApi * fixup which --> variant param rename * improve descriptions * migrate gem version * improve descriptions for ruby gems * standardise on packageName for all conda badges
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Joi from 'joi'
|
||||
import { BaseJsonService, NotFound } from '../index.js'
|
||||
import { BaseJsonService, NotFound, pathParams } from '../index.js'
|
||||
import {
|
||||
renderVersionBadge,
|
||||
searchServiceUrl,
|
||||
@@ -29,31 +29,36 @@ class FeedzVersionService extends BaseJsonService {
|
||||
|
||||
static route = {
|
||||
base: 'feedz',
|
||||
pattern: ':which(v|vpre)/:organization/:repository/:packageName',
|
||||
pattern: ':variant(v|vpre)/:organization/:repository/:packageName',
|
||||
}
|
||||
|
||||
static examples = [
|
||||
{
|
||||
title: 'Feedz',
|
||||
pattern: 'v/:organization/:repository/:packageName',
|
||||
namedParams: {
|
||||
organization: 'shieldstests',
|
||||
repository: 'mongodb',
|
||||
packageName: 'MongoDB.Driver.Core',
|
||||
static openApi = {
|
||||
'/feedz/{variant}/{organization}/{repository}/{packageName}': {
|
||||
get: {
|
||||
summary: 'Feedz Version',
|
||||
parameters: pathParams(
|
||||
{
|
||||
name: 'variant',
|
||||
example: 'v',
|
||||
description: 'version or version including pre-releases',
|
||||
schema: { type: 'string', enum: this.getEnum('variant') },
|
||||
},
|
||||
{
|
||||
name: 'organization',
|
||||
example: 'shieldstests',
|
||||
},
|
||||
{
|
||||
name: 'repository',
|
||||
example: 'mongodb',
|
||||
},
|
||||
{
|
||||
name: 'packageName',
|
||||
example: 'MongoDB.Driver.Core',
|
||||
},
|
||||
),
|
||||
},
|
||||
staticPreview: this.render({ version: '2.10.4' }),
|
||||
},
|
||||
{
|
||||
title: 'Feedz (with prereleases)',
|
||||
pattern: 'vpre/:organization/:repository/:packageName',
|
||||
namedParams: {
|
||||
organization: 'shieldstests',
|
||||
repository: 'mongodb',
|
||||
packageName: 'MongoDB.Driver.Core',
|
||||
},
|
||||
staticPreview: this.render({ version: '2.11.0-beta2' }),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static defaultBadgeData = {
|
||||
label: 'feedz',
|
||||
@@ -111,8 +116,8 @@ class FeedzVersionService extends BaseJsonService {
|
||||
}
|
||||
}
|
||||
|
||||
async handle({ which, organization, repository, packageName }) {
|
||||
const includePrereleases = which === 'vpre'
|
||||
async handle({ variant, organization, repository, packageName }) {
|
||||
const includePrereleases = variant === 'vpre'
|
||||
const baseUrl = this.apiUrl({ organization, repository })
|
||||
const json = await this.fetch({ baseUrl, packageName })
|
||||
const fetchedJson = await this.fetchItems({ json })
|
||||
|
||||
Reference in New Issue
Block a user