specfix

command
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command specfix приводит опубликованную спецификацию cloud.ru к OpenAPI 3.0, который понимает oapi-codegen. api/ остаётся как скачано; scripts/generate.sh пропускает через specfix compute, iam и kafka.

go run ./tools/specfix in.yaml out.yaml

Локальная правка Kafka: deprecated CreateClusterRequest.subnet_id ошибочно объявлен обязательным массивом без items; возвращаем необязательную строку. Остальные правила общие, не под конкретные схемы:

  • остатки Swagger 2 (iam): definitions → components.schemas, ссылки #/definitions/ → #/components/schemas/, swagger, consumes, produces убираются;
  • параметр без schema (type, format, items, enum, default прямо в параметре) — поля уходят в schema;
  • параметр in: body → requestBody application/json с его description и x-*; два тела или тело без schema — ошибка, а не молчаливый выбор;
  • ответ со schema без content (Swagger 2) → content application/json;
  • anyOf из схемы и {type: null} (OpenAPI 3.1, compute) → схема с nullable: true; иначе oapi-codegen делает анонимный union, и поле нельзя задать снаружи пакета. Остальные anyOf — настоящие объединения, не трогаются;
  • ссылка на схему, которой нет в components.schemas (compute: VmResourceFloatingIp), — схема объявляется объектом с любыми полями: в Go это map[string]any, данные не теряются.

Что исправлено — в stderr, по строке на правило. Код выхода: 0 — записано, 1 — ошибка.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL