Skip to content

Refs #API-19: Add title to every components schema - #23

Merged
franco-mariani merged 2 commits into
mainfrom
feature/api-19-api-v2-openapi-spec-schema-title
Nov 13, 2026
Merged

franco-mariani merged 2 commits into
mainfrom
feature/api-19-api-v2-openapi-spec-schema-title

Conversation

@franco-mariani

Copy link
Copy Markdown
Contributor

Linear: https://linear.app/samesystem/issue/API-19/api-v2-openapi-spec-schema-title

Problem

In Swagger Portal "Elements" (and similar doc portals), schemas referenced via $ref show up as anonymous objects because they have no title.

Change

Basic::Components::Schemas::TypeToSchemas now sets title to the schema name for both object and enum schemas. All components.schemas entries go through this class, so it covers basic and JSON:API schemas as well as request-body input schemas:

"User": {
  "title": "User",
  "type": "object",
  ...
}

Inline schemas inside paths are unchanged.

Tests

  • Updated expectations in the three type_to_schemas_spec.rb files
  • Regenerated spec/fixtures/apps/dummy_app_json_api/public/openapi.json (only adds the 9 title lines)
  • bundle exec rspec: 123 examples, 0 failures

Documentation portals (e.g. Swagger Elements) show referenced schemas as
anonymous objects unless they have a title. Set each component schema's
title to its name.
@franco-mariani
franco-mariani requested a review from a team October 8, 2026 14:50
@franco-mariani franco-mariani self-assigned this Oct 8, 2026
@franco-mariani
franco-mariani requested a balanced review from Copilot October 8, 2026 14:50

Copilot AI 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.

🟢 Approval recommended

The centralized implementation correctly covers object and enum component schemas with aligned tests and fixture output.

0 open findings

What changed in this PR

Adds schema titles so documentation portals display meaningful names for referenced OpenAPI components.

Changes:

  • Adds titles to generated object and enum schemas.
  • Updates unit expectations and the generated JSON:API fixture.
  • Documents the behavior in the changelog.
File Description
lib/​graphql_to_rest/​schema/​basic/​components/​schemas/​type_to_schemas.rb Generates titles for object and enum schemas.
spec/​lib/​graphql_to_rest/​schema/​basic/​components/​schemas/​type_to_schemas_spec.rb Verifies basic schema titles.
spec/​lib/​graphql_to_rest/​schema/​basic/​components/​request_bodies/​type_to_schemas_spec.rb Verifies input schema titles.
spec/​lib/​graphql_to_rest/​schema/​json_api/​components/​schemas/​type_to_schemas_spec.rb Verifies JSON:API schema titles.
spec/​fixtures/​apps/​dummy_app_json_api/​public/​openapi.json Updates generated OpenAPI output.
CHANGELOG.md Records the new schema-title behavior.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@franco-mariani
franco-mariani merged commit 2ef4e91 into main Nov 13, 2026
7 checks passed
@franco-mariani
franco-mariani deleted the feature/api-19-api-v2-openapi-spec-schema-title branch November 13, 2026 13:48
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.

3 participants