migrate examples to openApi part 11: enums; affects [codefactor conda depfu homebrew jsdelivr reddit sourceforge testspace vaadin github] (#9437)
* WIP enums * WIP moar enums * add a helper function for extracting enum from route pattern * add enum schemas to services * review and improve service names * convert some more services with enums * review and improve service names * fix issue/pull request detail
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import Joi from 'joi'
|
||||
import { metric } from '../text-formatters.js'
|
||||
import { nonNegativeInteger } from '../validators.js'
|
||||
import { BaseJsonService } from '../index.js'
|
||||
import { BaseJsonService, pathParams } from '../index.js'
|
||||
|
||||
const schema = Joi.object({
|
||||
count: nonNegativeInteger.required(),
|
||||
@@ -15,16 +15,24 @@ export default class SourceforgeOpenTickets extends BaseJsonService {
|
||||
pattern: ':project/:type(bugs|feature-requests)',
|
||||
}
|
||||
|
||||
static examples = [
|
||||
{
|
||||
title: 'Sourceforge Open Tickets',
|
||||
namedParams: {
|
||||
type: 'bugs',
|
||||
project: 'sevenzip',
|
||||
static openApi = {
|
||||
'/sourceforge/open-tickets/{project}/{type}': {
|
||||
get: {
|
||||
summary: 'Sourceforge Open Tickets',
|
||||
parameters: pathParams(
|
||||
{
|
||||
name: 'project',
|
||||
example: 'sevenzip',
|
||||
},
|
||||
{
|
||||
name: 'type',
|
||||
example: 'bugs',
|
||||
schema: { type: 'string', enum: this.getEnum('type') },
|
||||
},
|
||||
),
|
||||
},
|
||||
staticPreview: this.render({ count: 1338 }),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static defaultBadgeData = {
|
||||
label: 'open tickets',
|
||||
|
||||
Reference in New Issue
Block a user