Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions schemas/constructs/v1beta2/component/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,85 @@ components:
- version
- kind
- schema

ComponentGroupEntry:
type: object
description: "A grouping of components by a specific key (e.g., model name)."
required:
- key
- count
properties:
key:
type: string
description: "The name of the group."
maxLength: 500
count:
type: integer
format: int32
description: "The number of components in this group."
minimum: 0

ComponentSummary:
type: object
description: "Summary of components grouped by various criteria."
required:
- total
additionalProperties: false
properties:
total:
type: integer
format: int64
description: "Total number of components."
minimum: 0
byModel:
type: array
items:
$ref: "#/components/schemas/ComponentGroupEntry"
description: "Components grouped by model."
byCategory:
type: array
items:
$ref: "#/components/schemas/ComponentGroupEntry"
description: "Components grouped by category."
byRegistrant:
type: array
items:
$ref: "#/components/schemas/ComponentGroupEntry"
description: "Components grouped by registrant."

ComponentSummaryFilter:
type: object
description: "Filter parameters for component summary."
additionalProperties: false
properties:
modelName:
type: string
description: "Filter by model name."
maxLength: 500
categoryName:
type: string
description: "Filter by category name."
maxLength: 500
version:
type: string
description: "Filter by version."
maxLength: 100
status:
type: string
description: "Filter by status (e.g., enabled, disabled)."
default: "enabled"
maxLength: 50
annotations:
type: string
description: "Filter by annotations."
enum: ["true", "false"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The annotations filter is defined as a string enum with values "true" and "false". To maintain consistency with other boolean filters in this schema (such as greedy in RelationshipSummaryFilter) and to follow standard OpenAPI practices, this should be defined as type: boolean. Additionally, ensure that corresponding endpoints in other API versions (like v1beta1) are updated consistently.

        annotations:
          type: boolean
          description: "Filter by annotations."
References
  1. Schemas within the meshery/schemas repository should maintain a uniform pattern across all constructs.
  2. When updating an API endpoint, ensure that corresponding endpoints in other API versions (e.g., v1beta1 and v1beta2) are updated consistently to match exactly.

registrant:
type: string
description: "Filter by registrant name."
maxLength: 500
include:
type: array
items:
type: string
enum: ["by_model", "by_category", "by_registrant"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The enum values for the include array use snake_case, while the corresponding properties in the ComponentSummary object use camelCase. OpenAPI schema properties for payloads must exactly match the json tags of the corresponding server-side structs to prevent silent field dropping. If the server implementation uses camelCase, these enum values should be updated to match. Ensure this is applied consistently across API versions.

            enum: ["byModel", "byCategory", "byRegistrant"]
References
  1. OpenAPI schema properties for payloads must exactly match the json tags of the corresponding server-side structs.
  2. Field name casing in generated structs must match the casing in the source of truth, even if this leads to inconsistencies across different structs.
  3. When updating an API endpoint, ensure that corresponding endpoints in other API versions are updated consistently.

description: "Criteria for grouping the summary."
91 changes: 91 additions & 0 deletions schemas/constructs/v1beta2/relationship/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -556,3 +556,94 @@ components:
description: Indicates whether the relationship should be treated as a logical representation only
x-oapi-codegen-extra-tags:
json: "isAnnotation"

RelationshipGroupEntry:
type: object
description: "A grouping of relationships by a specific key (e.g., model name)."
required:
- key
- count
properties:
key:
type: string
description: "The name of the group."
maxLength: 500
count:
type: integer
format: int32
description: "The number of relationships in this group."
minimum: 0

RelationshipSummary:
type: object
description: "Summary of relationships grouped by various criteria."
required:
- total
additionalProperties: false
properties:
total:
type: integer
format: int64
description: "Total number of relationships."
minimum: 0
byModel:
type: array
items:
$ref: "#/components/schemas/RelationshipGroupEntry"
description: "Relationships grouped by model."
byKind:
type: array
items:
$ref: "#/components/schemas/RelationshipGroupEntry"
description: "Relationships grouped by kind."
byType:
type: array
items:
$ref: "#/components/schemas/RelationshipGroupEntry"
description: "Relationships grouped by type."
bySubType:
type: array
items:
$ref: "#/components/schemas/RelationshipGroupEntry"
description: "Relationships grouped by sub-type."

RelationshipSummaryFilter:
type: object
description: "Filter parameters for relationship summary."
additionalProperties: false
properties:
kind:
type: string
description: "Filter by relationship kind."
maxLength: 255
greedy:
type: boolean
description: "Filter by greedy status."
default: false
subType:
type: string
description: "Filter by sub-type."
maxLength: 255
relationshipType:
type: string
description: "Filter by relationship type."
maxLength: 255
version:
type: string
description: "Filter by version."
maxLength: 100
modelName:
type: string
description: "Filter by model name."
maxLength: 500
status:
type: string
description: "Filter by status (e.g., enabled, disabled)."
default: "enabled"
maxLength: 50
include:
type: array
items:
type: string
enum: ["by_model", "by_kind", "by_type", "by_subtype"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The enum values for the include array use snake_case, whereas the RelationshipSummary object uses camelCase. Casing in the schema must match the server-side source of truth (json tags). Using camelCase for these enum values would improve consistency across the API definition and match the server implementation. Ensure other API versions are updated to match.

            enum: ["byModel", "byKind", "byType", "bySubType"]
References
  1. OpenAPI schema properties for payloads must exactly match the json tags of the corresponding server-side structs.
  2. Field name casing in generated structs must match the casing in the source of truth.
  3. When updating an API endpoint, ensure that corresponding endpoints in other API versions are updated consistently.

description: "Criteria for grouping the summary."