chore: generate and update OAS for translations (#14281)

* chore: generate and update OAS for translations

* support localization header

* add locale to all store routes

* fixes

* small fix
This commit is contained in:
Shahed Nasser
2025-12-16 15:52:33 +02:00
committed by GitHub
parent 6815b3d7db
commit 53cdbaa069
75 changed files with 2322 additions and 6 deletions
@@ -0,0 +1,39 @@
/**
* @schema AdminLocale
* type: object
* description: The locale's details.
* x-schemaName: AdminLocale
* required:
* - code
* - name
* - created_at
* - updated_at
* - deleted_at
* properties:
* code:
* type: string
* title: code
* description: The locale's code in BCP 47 format.
* example: fr-FR
* name:
* type: string
* title: name
* description: The locale's display name.
* created_at:
* type: string
* format: date-time
* title: created_at
* description: The date and time at which the locale was created.
* updated_at:
* type: string
* format: date-time
* title: updated_at
* description: The date and time at which the locale was last updated.
* deleted_at:
* type: string
* format: date-time
* title: deleted_at
* description: The date and time at which the locale was deleted.
*
*/
@@ -0,0 +1,36 @@
/**
* @schema AdminLocaleListResponse
* type: object
* description: The list of locales with pagination details.
* x-schemaName: AdminLocaleListResponse
* required:
* - limit
* - offset
* - count
* - locales
* properties:
* limit:
* type: number
* title: limit
* description: The maximum number of locales returned.
* offset:
* type: number
* title: offset
* description: The number of locales skipped before retrieving the returned locales.
* count:
* type: number
* title: count
* description: The total number of locales matching the query.
* estimate_count:
* type: number
* title: estimate_count
* description: The estimated count retrieved from the PostgreSQL query planner, which may be inaccurate.
* x-featureFlag: index_engine
* locales:
* type: array
* description: The list of locales.
* items:
* $ref: "#/components/schemas/AdminLocale"
*
*/
@@ -0,0 +1,13 @@
/**
* @schema AdminLocaleResponse
* type: object
* description: The locale's details.
* x-schemaName: AdminLocaleResponse
* required:
* - locale
* properties:
* locale:
* $ref: "#/components/schemas/AdminLocale"
*
*/
@@ -7,6 +7,7 @@
* - id
* - name
* - supported_currencies
* - supported_locales
* - default_sales_channel_id
* - default_region_id
* - default_location_id
@@ -55,6 +56,11 @@
* format: date-time
* title: updated_at
* description: The date the store was updated.
* supported_locales:
* type: array
* description: The store's supported locales.
* items:
* $ref: "#/components/schemas/AdminStoreLocale"
*
*/
@@ -0,0 +1,46 @@
/**
* @schema AdminStoreLocale
* type: object
* description: The details of a store's locale.
* x-schemaName: AdminStoreLocale
* required:
* - id
* - locale_code
* - store_id
* - locale
* - created_at
* - updated_at
* - deleted_at
* properties:
* id:
* type: string
* title: id
* description: The locale's ID.
* locale_code:
* type: string
* title: locale_code
* description: The locale's code in BCP 47 format.
* store_id:
* type: string
* title: store_id
* description: The ID of the store to which the locale belongs.
* locale:
* $ref: "#/components/schemas/AdminLocale"
* created_at:
* type: string
* format: date-time
* title: created_at
* description: The date the locale was created.
* updated_at:
* type: string
* format: date-time
* title: updated_at
* description: The date the locale was updated.
* deleted_at:
* type: string
* format: date-time
* title: deleted_at
* description: The date the locale was deleted.
*
*/
@@ -0,0 +1,58 @@
/**
* @schema AdminTranslation
* type: object
* description: The translation's details.
* x-schemaName: AdminTranslation
* required:
* - id
* - reference_id
* - reference
* - locale_code
* - translations
* - created_at
* - updated_at
* - deleted_at
* properties:
* id:
* type: string
* title: id
* description: The translation's ID.
* reference_id:
* type: string
* title: reference_id
* description: The ID of the resource that the translation belongs to. For example, the ID of a product.
* example: prod_123
* reference:
* type: string
* title: reference
* description: The resource that the translation belongs to.
* example: product
* locale_code:
* type: string
* title: locale_code
* description: The translation's locale code in BCP 47 format.
* example: fr-FR
* translations:
* type: object
* description: The translation key-value pairs. Each key is a field in the resource, and the value is the translated text.
* example:
* title: Chaussures
* description: Des chaussures élégantes.
* created_at:
* type: string
* format: date-time
* title: created_at
* description: The date that the translation was created.
* updated_at:
* type: string
* format: date-time
* title: updated_at
* description: The date that the translation was updated.
* deleted_at:
* type: string
* format: date-time
* title: deleted_at
* description: The date that the translation was deleted.
*
*/
@@ -0,0 +1,16 @@
/**
* @schema AdminTranslationSettingsResponse
* type: object
* description: The translation settings' details.
* x-schemaName: AdminTranslationSettingsResponse
* required:
* - translatable_fields
* properties:
* translatable_fields:
* type: object
* description: Key-value pairs of translatable fields for different entities. Each key is an entity type, and the value is an array of fields that can be translated for that entity.
* example:
* product: ["title", "description"]
*
*/
@@ -0,0 +1,72 @@
/**
* @schema AdminTranslationStatisticsResponse
* type: object
* description: The translation statistics details.
* x-schemaName: AdminTranslationStatisticsResponse
* required:
* - statistics
* properties:
* statistics:
* type: object
* description: The translation statistics for different entity types. The key is the entity type, and the value is an object containing the statistics for that entity type.
* example:
* product:
* expected: 150
* translated: 120
* missing: 30
* by_locale:
* fr-FR:
* expected: 150
* translated: 120
* missing: 30
* required:
* - by_locale
* - expected
* - translated
* - missing
* additionalProperties:
* type: object
* properties:
* by_locale:
* type: object
* description: The translation statistics of an entity type broken down by locale. The key is the locale code in BCP 47 format, and
* the value is an object containing the statistics for that locale.
* example:
* fr-FR:
* expected: 150
* translated: 120
* missing: 30
* required:
* - expected
* - translated
* - missing
* additionalProperties:
* type: object
* properties:
* expected:
* type: number
* title: expected
* description: The total number of translatable fields.
* translated:
* type: number
* title: translated
* description: The number of translated fields.
* missing:
* type: number
* title: missing
* description: The number of fields that are yet to be translated.
* expected:
* type: number
* title: expected
* description: The total number of translatable fields across specified locales.
* translated:
* type: number
* title: translated
* description: The number of translated fields across specified locales.
* missing:
* type: number
* title: missing
* description: The number of fields that are yet to be translated across specified locales.
*
*/
@@ -0,0 +1,47 @@
/**
* @schema AdminTranslationsBatchResponse
* type: object
* description: The batch response for managing translations.
* x-schemaName: AdminTranslationsBatchResponse
* required:
* - created
* - updated
* - deleted
* properties:
* created:
* type: array
* description: The created translations.
* items:
* $ref: "#/components/schemas/AdminTranslation"
* updated:
* type: array
* description: The updated translations.
* items:
* $ref: "#/components/schemas/AdminTranslation"
* deleted:
* type: object
* description: Summary of the deleted translations.
* required:
* - ids
* - object
* - deleted
* properties:
* ids:
* type: array
* description: The IDs of the deleted translations.
* items:
* type: string
* title: ids
* description: A translation ID.
* object:
* type: string
* title: object
* description: The type of object deleted.
* default: translation
* deleted:
* type: boolean
* title: deleted
* description: Whether the translations were successfully deleted.
*
*/
@@ -19,6 +19,11 @@
* externalDocs:
* url: https://docs.medusajs.com/api/admin#manage-metadata
* description: Learn how to manage metadata
* locale:
* type: string
* title: locale
* description: The order's locale in [BCP 47](https://gist.github.com/typpo/b2b828a35e683b9bf8db91b5404f1bd1) format.
* example: en-US
*
*/
@@ -31,6 +31,11 @@
* externalDocs:
* url: https://docs.medusajs.com/api/admin#manage-metadata
* description: Learn how to manage metadata
* supported_locales:
* type: array
* description: The store's supported locales.
* items:
* $ref: "#/components/schemas/AdminUpdateStoreSupportedLocale"
*
*/
@@ -0,0 +1,16 @@
/**
* @schema AdminUpdateStoreSupportedLocale
* type: object
* description: The payload to update a store's supported locale.
* x-schemaName: AdminUpdateStoreSupportedLocale
* required:
* - locale_code
* properties:
* locale_code:
* type: string
* title: locale_code
* description: The locale's code in [BCP 47 format](https://gist.github.com/typpo/b2b828a35e683b9bf8db91b5404f1bd1).
* example: fr-FR
*
*/
@@ -325,6 +325,11 @@
* description: The custom display ID of the order.
* externalDocs:
* url: https://docs.medusajs.com/resources/commerce-modules/order/custom-display-id
* locale:
* type: string
* title: locale
* description: The order's locale in [BCP 47](https://gist.github.com/typpo/b2b828a35e683b9bf8db91b5404f1bd1) format.
* example: en-US
*
*/
@@ -0,0 +1,22 @@
/**
* @schema StoreLocale
* type: object
* description: The store locale's details.
* x-schemaName: StoreLocale
* required:
* - code
* - name
* properties:
* code:
* type: string
* title: code
* description: The locale's code in [BCP 47 format](https://gist.github.com/typpo/b2b828a35e683b9bf8db91b5404f1bd1).
* example: en-US
* name:
* type: string
* title: name
* description: The locale's display name.
* example: English (United States)
*
*/
@@ -0,0 +1,16 @@
/**
* @schema StoreLocaleListResponse
* type: object
* description: The list of supported locales in the store.
* x-schemaName: StoreLocaleListResponse
* required:
* - locales
* properties:
* locales:
* type: array
* description: The list of supported locales in the store.
* items:
* $ref: "#/components/schemas/StoreLocale"
*
*/