Skip to content

update openapi to 3.1.0 - #545

Open
slashburygin wants to merge 1 commit into
masterfrom
openapi
Open

update openapi to 3.1.0#545
slashburygin wants to merge 1 commit into
masterfrom
openapi

Conversation

@slashburygin

@slashburygin slashburygin commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Update OpenAPI specifications and test harness to support both 3.0.3 and 3.1.0 versions, enriching metadata and expanding VM-related schemas and endpoints across user, boot, status, and orchestration APIs.

Enhancements:

  • Upgrade boot, status, and orchestration OpenAPI documents from 3.0.3 to 3.1.0 with JSON Schema dialect and richer info metadata (license, contact, terms of service).
  • Refocus core schemas and paths around VM, Port, IP address, Tag, and VM definition/filter resources, replacing legacy UniversalAgent and related models in the boot, status, and orch specs.
  • Add parallel OpenAPI user specifications for both 3.0.3 and 3.1.0, sharing the same functional-test VM/Port/IP/Tag model surface.
  • Extend API surface with additional VM action endpoints (power, power state, power on/off, IP address retrieval) and list/filter endpoints such as VMDefSort, VMNoProcessFilters, and VMNoSort collections.

Tests:

  • Adjust manual OpenAPI test to fetch specifications for both 3.0.3 and 3.1.0 versions and to generate versioned user spec files while targeting 3.1.0 for boot, orch, and status APIs.

@slashburygin
slashburygin requested a review from a team as a code owner July 31, 2026 07:07

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @slashburygin, your pull request is larger than the review limit of 150000 diff characters

@sourcery-ai

sourcery-ai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR upgrades the project’s OpenAPI specifications and generation flow to support both OpenAPI 3.0.3 and 3.1.0, adds new 3.1.0-compliant specs for boot/orch/status/user APIs, refactors schema/tag/operation naming around VM-centric resources, and updates the manual OpenAPI test to fetch and write out versioned specification files.

Entity relationship diagram for VM-centric resources in updated OpenAPI specs

erDiagram
  VM {
    string uuid
    string name
    string state
    string status
  }
  Port {
    string uuid
    string mac
    string vm
  }
  IpAddress {
    string uuid
    string ip
    string port
  }
  Tag {
    string uuid
    string name
    string vm
  }

  VM ||--o{ Port : has
  Port ||--o{ IpAddress : has
  VM ||--o{ Tag : has
Loading

File-Level Changes

Change Details Files
Upgrade boot, status, and orch OpenAPI specs to 3.1.0 and align them around VM-centric resources and functional-test metadata.
  • Change top-level OpenAPI version from 3.0.3 to 3.1.0 and declare jsonSchemaDialect in each spec.
  • Replace legacy Exordos titles/descriptions with REST API Microservice metadata, including termsOfService, license, and contact.
  • Rename legacy UniversalAgent/MachineNetboot/Resource/KindModel/Node* schemas and operations to VM, Port, IpAddress, Tag, VMDefSort, VMNoProcessFilters, and VMNoSort variants.
  • Normalize VM-related schemas (Create/Get/Filter/Update) to share a consistent property set (state, name, just-none, status, created, updated) and required fields.
  • Refactor paths, parameters, and tags so all resources hang under /v1/vms/... and new tag groups (functional-test, VM, Port, etc.) replace legacy groupings.
  • Add explicit specification endpoints for both /specifications/3.0.3 and /specifications/3.1.0 in each spec.
docs/openapi/openapi_boot.yaml
docs/openapi/openapi_status.yaml
docs/openapi/openapi_orch.yaml
Extend the manual OpenAPI test to generate versioned user specifications for both 3.0.3 and 3.1.0 and to use the new 3.1.0 specs for boot/orch/status.
  • Introduce OPENAPI_VERSION_3_0_3/OPENAPI_VERSION_3_1_0 constants and OPENAPI_VERSIONS list.
  • Change SPECIFICATIONS_PATH to point at the versionless base path and iterate over OPENAPI_VERSIONS when fetching the user spec.
  • For each user spec version, write a separate openapi_user_{version}.yaml file with normalized server URL and info.version.
  • Update boot/orch/status spec fetches to explicitly use the 3.1.0 specification URL instead of the old 3.0.3-specific path.
exordos_core/tests/manual/openapi/test_openapi.py
Add generated user OpenAPI spec artifacts for both OpenAPI 3.0.3 and 3.1.0 to the docs tree.
  • Add openapi_user_3.1.0.yaml containing the 3.1.0 user-facing spec aligned with the VM-centric schema and path model.
  • Add openapi_user_3.0.3.yaml containing the 3.0.3 user-facing spec with equivalent semantics but 3.0-style schema constructs.
docs/openapi/openapi_user_3.1.0.yaml
docs/openapi/openapi_user_3.0.3.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

properties: {}
default:
$ref: '#/components/responses/Error'
operationId: Get_OpenApi_specification

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This operationId is duplicated by the 3.0.3 specification endpoint in the same document. Please include the OpenAPI version in the operationId (for example, Get_OpenApi_specification_3_1_0) so client generators can consume the spec.

content:
application/json:
schema:
$ref: '#/components/schemas/Unknown_Create'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unknown_Create is referenced here, but no matching schema is emitted under components.schemas. This makes the generated OpenAPI document invalid and prevents client generation. Please either emit the schema or omit this placeholder route from the published specification.

info:
title: Exordos Core v1 Boot API
title: REST API Microservice

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is the published Boot API reference, but this update replaces its service metadata and route surface with the functional-test fixture: it now advertises REST API Microservice, localhost, and VM test routes that boot_api does not expose. Please generate these docs from the actual service contract, or keep the test fixture output out of docs/openapi.

type: integer
description: The HTTP status code
minimum: 400
exclusiveMaximum: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This document is now declared as OpenAPI 3.1, where exclusiveMaximum must be a numeric boundary rather than a boolean. The current true value makes the schema invalid for 3.1 tooling. Please remove it or express the intended numeric constraint with the 3.1 syntax.

for version in OPENAPI_VERSIONS:
url = f"{user_api.get_endpoint()}{SPECIFICATIONS_PATH}{version}"
response = client.get(url, timeout=30)
assert response.status_code == 200

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A 200 response only proves that the endpoint is reachable; the document is then written without any OpenAPI validation. That allowed the invalid specs in this change to be committed. Please validate each generated document before writing it, including unique operationIds and resolvable component references.

- name: functional-test
description: Just functional tests
externalDocs:
url: https://https://functional.tests/docs/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated externalDocs URL has the scheme twice, so it resolves to an invalid destination. This same malformed value is present in all generated specs; please correct the source metadata before publishing the documents.

minLength: 0
maxLength: 10
example: any_string
default: off

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state is declared as a string, but unquoted off is parsed by YAML consumers as boolean false. This makes the default type-invalid throughout the generated spec. Please emit it as a quoted string ("off") in every affected schema and parameter.

@phantomii phantomii left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the generated OpenAPI documents need to be corrected and validated before merge. See the inline review comments for the required fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants