Files
shields/scripts/export-openapi-cli.js
T
jNullj cb34c2fb62 refactor: rename deprecatedService to retiredService [*****] (#11803)
* refactor: rename deprecatedService to retiredService

- Updated all instances of deprecatedService to retiredService in service implementations, tests, and documentation.
- Changed attribute names from isDeprecated to isRetired in relevant schemas and service definitions.
- Adjusted tests and documentation to reflect the new terminology and ensure consistency.

* docs: rename deprecating-badges.md to retiring-badges.md

* refactor: rename files deprecated-service to retired-service

* refactor: update terminology from deprecated to retired in badge documentation
2026-05-10 23:11:05 +03:00

54 lines
1.4 KiB
JavaScript

import fs from 'fs'
import path from 'path'
import yaml from 'js-yaml'
import { collectDefinitions } from '../core/base-service/loader.js'
import { category2openapi } from '../core/base-service/openapi.js'
const specsPath = path.join('frontend', 'categories')
function writeSpec(filename, spec) {
// Omit undefined
// https://github.com/nodeca/js-yaml/issues/356#issuecomment-312430599
const cleaned = JSON.parse(JSON.stringify(spec))
fs.writeFileSync(
filename,
yaml.dump(cleaned, { flowLevel: 5, forceQuotes: true }),
)
}
;(async () => {
const definitions = await collectDefinitions()
for (const category of definitions.categories) {
const services = definitions.services.filter(
service => service.category === category.id && !service.isRetired,
)
writeSpec(
path.join(specsPath, `${category.id}.yaml`),
category2openapi({ category, services, sort: true }),
)
}
let coreServices = []
coreServices = coreServices.concat(
definitions.services.filter(
service => service.category === 'static' && !service.isRetired,
),
)
coreServices = coreServices.concat(
definitions.services.filter(
service => service.category === 'dynamic' && !service.isRetired,
),
)
writeSpec(
path.join(specsPath, '1core.yaml'),
category2openapi({
category: { name: 'Core' },
services: coreServices,
sort: false,
}),
)
})()