feat:Standardize OpenAPI spec: ISO 8601 dates and array defaults#134
feat:Standardize OpenAPI spec: ISO 8601 dates and array defaults#134
Conversation
WalkthroughThis pull request standardizes the OpenAPI specification for the Ideogram API by converting datetime representations to explicit ISO 8601 format with timezone offsets (+00:00) across all example payloads and responses, introducing default: [] for array-type fields in public schemas, and adding security: [] blocks to internal-testing endpoints. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/libs/Ideogram/openapi.yaml`:
- Around line 553-562: The example responses in openapi.yaml include fields that
don't match the defined schemas: the Invoice schema expects invoice_status (not
status) and does not define invoice_paid_date, and the SpendCommitInfo schema
expects commit_amount_spent (not commit_spend_balance); update the example
objects under the invoices and spend commit examples to use the exact schema
property names (replace status→invoice_status, remove invoice_paid_date or move
its value to a schema-approved field, and replace
commit_spend_balance→commit_amount_spent) so examples fully conform to the
Invoice and SpendCommitInfo schemas referenced in the spec.
- Around line 3895-3902: The examples for ApiProfileApiKey currently set
ApiProfileApiKey.status to null which violates the non-null ApiKeyStatus enum
(ACTIVE | DISABLED); update each example instance (the example objects
containing creation_time, redacted_api_key, api_key_id) to use a valid
ApiKeyStatus value (e.g., "ACTIVE" or "DISABLED") for the status field, or if
null is legitimately possible, change the ApiKeyStatus schema to allow null
(widen the schema) so examples and schema agree; apply this fix for all similar
example blocks (the repeated example objects near the shown creation_time
entries).
- Line 175: The operation-level "security: []" entry is explicitly disabling the
root ApiKeyAuth requirement and making the endpoint unauthenticated; remove the
`security: []` line (or replace it with the appropriate security requirement
referencing the root `ApiKeyAuth`) so the operation inherits the global
authentication, ensuring the endpoint is not left public.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 549d3553-6861-4bd7-ab58-71e90750b961
⛔ Files ignored due to path filters (79)
src/libs/Ideogram/Generated/Ideogram.IManageClient.AddOrganizationMembers.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUsageInfo.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.IManageClient.PromoteOrganizationMembers.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.IManageClient.RemoveOrganizationMembers.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.ManageClient.AddOrganizationMembers.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUsageInfo.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.ManageClient.PromoteOrganizationMembers.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.ManageClient.RemoveOrganizationMembers.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.AddOrganizationMembersRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ApiOrganizationUserSuggestion.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ApiProfile.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ApiProfileApiKey.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ApiTerms.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteMember.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithMembers.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithPresetName.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.CreateApiKeyResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.DescribeRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.EditImageRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.EditImageRequestV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageSafetyError.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GenerateTransparentImageRequestV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GetApiKeysResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GetApiKeysV2Response.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GetApiOrganizationUserSuggestionsResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GetApiProfilesResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GetApiTermsResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GetOrganizationMembersResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GetUsageInfoResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.GetUserCreditsResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ImageLayerV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ImageObject.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ImageRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ImageSafetyError.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResultsResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResultsResponseResultsInner.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingNestedObjectRequiredFields.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.Invoice.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.InvoiceLineItem.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationResponseV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.LayerizeDesignRequestV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ListOrganizationInvoicesResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ManageApiSubscriptionResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMember.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMemberOperationResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMemberOperationResult.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.PostApiKeyResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.PostApiTermsRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.Price.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.PromoteOrganizationMembersRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.RechargeSettings.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.RechargeSettingsResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.RedactedApiKey.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ReframeImageRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ReframeImageRequestV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequestV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.RemoveOrganizationMembersRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ReplaceBackgroundRequestV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.SpendCommitInfo.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.SpendCommitInfoResponse.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.TextLayerV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.ToolUsage.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.TryOnRequestV3.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.UpscaleImageRequest.g.csis excluded by!**/generated/**src/libs/Ideogram/Generated/Ideogram.Models.UsageSegment.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/Ideogram/openapi.yaml
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/postInternalTesting_200_response' | ||
| security: [ ] |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
In OpenAPI, does an operation-level security: [] override top-level security and make the operation unauthenticated?
💡 Result:
Yes. In OpenAPI, an operation’s security overrides the top-level (global) security. If you set an operation to:
security: []that explicitly removes the global security requirement for that operation—i.e., the operation has no required authentication (from the spec’s point of view). If you want the operation to use the global security, omit the operation-level security field instead. [1], [2]
Sources:
[1] OpenAPI Specification (security override + empty array removes top-level security) (spec.openapis.org)
[2] Swagger docs (global security can be overridden per-operation, including “no authentication”) (swagger.io)
Citations:
- 1: https://spec.openapis.org/oas/v3.2.0.html?utm_source=openai
- 2: https://swagger.io/docs/specification/v3_0/authentication/?utm_source=openai
Remove security: [] unless this endpoint is intentionally public.
Setting security: [] at the operation level explicitly overrides the root ApiKeyAuth requirement, making this endpoint unauthenticated per the OpenAPI spec. For an internal-testing endpoint, this is likely unintended and would drop authentication at the gateway/client layer.
Suggested fix
- security: [ ]📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| security: [ ] |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/libs/Ideogram/openapi.yaml` at line 175, The operation-level "security:
[]" entry is explicitly disabling the root ApiKeyAuth requirement and making the
endpoint unauthenticated; remove the `security: []` line (or replace it with the
appropriate security requirement referencing the root `ApiKeyAuth`) so the
operation inherits the global authentication, ensuring the endpoint is not left
public.
| example: | ||
| invoices: | ||
| - start_time: '2024-01-01' | ||
| end_time: '2024-01-31T23:59:59.0000000+00:00' | ||
| - start_time: '2024-01-01T00:00:00+00:00' | ||
| end_time: '2024-01-31T23:59:59+00:00' | ||
| total_spend: | ||
| currency_code: USD | ||
| amount: 15000 | ||
| status: PAID | ||
| issued_time: '2024-02-01' | ||
| invoice_paid_date: '2024-02-05T10:30:00.0000000+00:00' | ||
| issued_time: '2024-02-01T00:00:00+00:00' | ||
| invoice_paid_date: '2024-02-05T10:30:00+00:00' |
There was a problem hiding this comment.
These response examples still don't match their referenced schemas.
While updating the timestamps, these payloads kept fields that the schemas do not define: Invoice uses invoice_status and has no invoice_paid_date, and SpendCommitInfo uses commit_amount_spent, not commit_spend_balance. Invalid examples are easy to propagate into docs and generated tests.
Suggested fix
- status: PAID
+ invoice_status: PAID
- invoice_paid_date: '2024-02-05T10:30:00+00:00'
- - commit_spend_balance:
+ - commit_amount_spent:Also applies to: 805-813
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/libs/Ideogram/openapi.yaml` around lines 553 - 562, The example responses
in openapi.yaml include fields that don't match the defined schemas: the Invoice
schema expects invoice_status (not status) and does not define
invoice_paid_date, and the SpendCommitInfo schema expects commit_amount_spent
(not commit_spend_balance); update the example objects under the invoices and
spend commit examples to use the exact schema property names (replace
status→invoice_status, remove invoice_paid_date or move its value to a
schema-approved field, and replace commit_spend_balance→commit_amount_spent) so
examples fully conform to the Invoice and SpendCommitInfo schemas referenced in
the spec.
| items: | ||
| $ref: '#/components/schemas/RedactedApiKey' | ||
| description: The current API keys that are active. Only returns redacted keys. | ||
| default: [ ] |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
for file in \
src/libs/Ideogram/Generated/Ideogram.Models.GetApiKeysResponse.g.cs \
src/libs/Ideogram/Generated/Ideogram.Models.GetApiProfilesResponse.g.cs \
src/libs/Ideogram/Generated/Ideogram.Models.ApiProfile.g.cs \
src/libs/Ideogram/Generated/Ideogram.Models.Invoice.g.cs
do
echo "== $file =="
sed -n '1,140p' "$file" | rg -n "Default Value: \[\]|IList<|JsonRequired|= new global::System.Collections.Generic.List|= \[\]"
echo
doneRepository: tryAGI/Ideogram
Length of output: 2415
Spec-to-code mismatch: default: [] in OpenAPI spec not materialized in generated C# models.
The OpenAPI spec documents default: [] for collection properties, and the C# code generation includes this in XML documentation comments (/// Default Value: []). However, the generated properties lack initializers—some are nullable without defaults, others are marked required without initializers. This breaks the contract: the spec promises empty arrays, but the SDK offers null or uninitialized collections.
Either initialize these properties to empty lists in codegen (= new List<>() or = []), or remove the default: [] from the OpenAPI spec.
Also applies to lines: 3885-3885, 3957-3957, 4050-4050, 4106-4106, 4207-4207, 4265-4265, 4310-4310, 4331-4331, 4352-4352, 4442-4442
| - creation_time: '2000-01-23T04:56:07+00:00' | ||
| redacted_api_key: ATG56••••••••••••• | ||
| api_key_id: JRPVD7jWR1aTBYiJ0UFVOg | ||
| status: '' | ||
| - creation_time: '2000-01-23T04:56:07.0000000+00:00' | ||
| status: null | ||
| - creation_time: '2000-01-23T04:56:07+00:00' | ||
| redacted_api_key: ATG56••••••••••••• | ||
| api_key_id: JRPVD7jWR1aTBYiJ0UFVOg | ||
| status: '' | ||
| status: null |
There was a problem hiding this comment.
Use a real ApiKeyStatus value in these examples.
ApiProfileApiKey.status is required and its schema is the non-null enum ACTIVE | DISABLED, but the updated examples set it to null. That leaves the examples invalid against the schema.
Suggested fix
- status: null
+ status: ACTIVEIf null is actually possible in responses, the schema needs to be widened instead.
Also applies to: 3911-3918, 3975-3982, 4024-4030, 4210-4217
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/libs/Ideogram/openapi.yaml` around lines 3895 - 3902, The examples for
ApiProfileApiKey currently set ApiProfileApiKey.status to null which violates
the non-null ApiKeyStatus enum (ACTIVE | DISABLED); update each example instance
(the example objects containing creation_time, redacted_api_key, api_key_id) to
use a valid ApiKeyStatus value (e.g., "ACTIVE" or "DISABLED") for the status
field, or if null is legitimately possible, change the ApiKeyStatus schema to
allow null (widen the schema) so examples and schema agree; apply this fix for
all similar example blocks (the repeated example objects near the shown
creation_time entries).
Summary by CodeRabbit