From 367346309f9360a12499b1cc4606a521b2a708a6 Mon Sep 17 00:00:00 2001 From: javorosas Date: Fri, 16 Oct 2026 14:54:07 +0200 Subject: [PATCH 1/5] docs: describe original fiscal stamp string availability --- website/openapi_v2.en.yaml | 13 ++++++++++--- website/openapi_v2.yaml | 15 +++++++++++---- website/test/openapi-types.fixture.txt | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/website/openapi_v2.en.yaml b/website/openapi_v2.en.yaml index 24e107210..bb636dfb7 100644 --- a/website/openapi_v2.en.yaml +++ b/website/openapi_v2.en.yaml @@ -13689,6 +13689,16 @@ components: type: object description: Information about the digital stamp added by the PAC. properties: + uuid: + type: string + format: uuid + description: UUID as written in the digital fiscal stamp. + version: + type: string + description: Digital fiscal stamp version. + legend: + type: string + description: Optional legend included in the digital fiscal stamp. signature: type: string description: Digital signature of the fiscal document. @@ -17402,9 +17412,6 @@ components: allOf: - $ref: '#/components/schemas/Stamp' required: [date, sat_signature, sat_cert_number, signature, complement_string] - properties: - complement_string: - type: string InvoicePending: title: Pending allOf: diff --git a/website/openapi_v2.yaml b/website/openapi_v2.yaml index 7e0dc190c..ed7782c5f 100644 --- a/website/openapi_v2.yaml +++ b/website/openapi_v2.yaml @@ -13641,6 +13641,16 @@ components: type: object description: Información sobre el timbre fiscal digital agregado por el PAC. properties: + uuid: + type: string + format: uuid + description: UUID tal como aparece en el timbre fiscal digital. + version: + type: string + description: Versión del timbre fiscal digital. + legend: + type: string + description: Leyenda opcional incluida en el timbre fiscal digital. signature: type: string description: Sello digital del comprobante fiscal. @@ -13650,7 +13660,7 @@ components: example: "2026-09-17T06:59:16" complement_string: type: [string, 'null'] - description: Cadena original del timbre fiscal digital. + description: Cadena original del timbre fiscal digital. Es null cuando los datos disponibles del timbre no permiten reconstruirla. rfc_provider_cert: type: string description: RFC del proveedor que certificó el comprobante. @@ -17356,9 +17366,6 @@ components: allOf: - $ref: '#/components/schemas/Stamp' required: [date, sat_signature, sat_cert_number, signature, complement_string] - properties: - complement_string: - type: string InvoicePending: title: Pendiente allOf: diff --git a/website/test/openapi-types.fixture.txt b/website/test/openapi-types.fixture.txt index 21d386c4f..06e4509d6 100644 --- a/website/test/openapi-types.fixture.txt +++ b/website/test/openapi-types.fixture.txt @@ -167,7 +167,7 @@ const createdInvoiceStamp: components["schemas"]["Stamp"] | null | undefined = c void createdInvoiceDate; void createdInvoiceStamp; if (createdInvoiceResponse.status === 'valid' || createdInvoiceResponse.status === 'canceled') { - const stampedFields: [string, string, string, string, string, string] = [ + const stampedFields: [string, string, string, string, string, string | null] = [ createdInvoiceResponse.uuid, createdInvoiceResponse.stamp.date, createdInvoiceResponse.stamp.signature, From 82ba7008fe73ec67d73418c053dd98d67266bbda Mon Sep 17 00:00:00 2001 From: javorosas Date: Fri, 16 Oct 2026 16:57:14 +0200 Subject: [PATCH 2/5] docs: keep invoice UUID as the sole fiscal identifier --- website/openapi_v2.en.yaml | 4 ---- website/openapi_v2.yaml | 4 ---- 2 files changed, 8 deletions(-) diff --git a/website/openapi_v2.en.yaml b/website/openapi_v2.en.yaml index bb636dfb7..a53581247 100644 --- a/website/openapi_v2.en.yaml +++ b/website/openapi_v2.en.yaml @@ -13689,10 +13689,6 @@ components: type: object description: Information about the digital stamp added by the PAC. properties: - uuid: - type: string - format: uuid - description: UUID as written in the digital fiscal stamp. version: type: string description: Digital fiscal stamp version. diff --git a/website/openapi_v2.yaml b/website/openapi_v2.yaml index ed7782c5f..ff94506f1 100644 --- a/website/openapi_v2.yaml +++ b/website/openapi_v2.yaml @@ -13641,10 +13641,6 @@ components: type: object description: Información sobre el timbre fiscal digital agregado por el PAC. properties: - uuid: - type: string - format: uuid - description: UUID tal como aparece en el timbre fiscal digital. version: type: string description: Versión del timbre fiscal digital. From 313e996ab20be7e0bd71176e4bb670f73574ac2d Mon Sep 17 00:00:00 2001 From: javorosas Date: Fri, 16 Oct 2026 17:06:17 +0200 Subject: [PATCH 3/5] docs: require the original stamp string on stamped invoices --- website/openapi_v2.en.yaml | 3 +++ website/openapi_v2.yaml | 5 ++++- website/test/openapi-types.fixture.txt | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/website/openapi_v2.en.yaml b/website/openapi_v2.en.yaml index a53581247..0cfc3f611 100644 --- a/website/openapi_v2.en.yaml +++ b/website/openapi_v2.en.yaml @@ -17408,6 +17408,9 @@ components: allOf: - $ref: '#/components/schemas/Stamp' required: [date, sat_signature, sat_cert_number, signature, complement_string] + properties: + complement_string: + type: string InvoicePending: title: Pending allOf: diff --git a/website/openapi_v2.yaml b/website/openapi_v2.yaml index ff94506f1..e0142950e 100644 --- a/website/openapi_v2.yaml +++ b/website/openapi_v2.yaml @@ -13656,7 +13656,7 @@ components: example: "2026-09-17T06:59:16" complement_string: type: [string, 'null'] - description: Cadena original del timbre fiscal digital. Es null cuando los datos disponibles del timbre no permiten reconstruirla. + description: Cadena original del timbre fiscal digital. rfc_provider_cert: type: string description: RFC del proveedor que certificó el comprobante. @@ -17362,6 +17362,9 @@ components: allOf: - $ref: '#/components/schemas/Stamp' required: [date, sat_signature, sat_cert_number, signature, complement_string] + properties: + complement_string: + type: string InvoicePending: title: Pendiente allOf: diff --git a/website/test/openapi-types.fixture.txt b/website/test/openapi-types.fixture.txt index 06e4509d6..21d386c4f 100644 --- a/website/test/openapi-types.fixture.txt +++ b/website/test/openapi-types.fixture.txt @@ -167,7 +167,7 @@ const createdInvoiceStamp: components["schemas"]["Stamp"] | null | undefined = c void createdInvoiceDate; void createdInvoiceStamp; if (createdInvoiceResponse.status === 'valid' || createdInvoiceResponse.status === 'canceled') { - const stampedFields: [string, string, string, string, string, string | null] = [ + const stampedFields: [string, string, string, string, string, string] = [ createdInvoiceResponse.uuid, createdInvoiceResponse.stamp.date, createdInvoiceResponse.stamp.signature, From bf48534b2cd78bd2fcdf63de10b1429fd20bfa0e Mon Sep 17 00:00:00 2001 From: "raul@facturapi.io" Date: Mon, 19 Oct 2026 19:37:27 -0600 Subject: [PATCH 4/5] fix(openapi): avoid incompatible schema intersections --- website/openapi_v2.en.yaml | 204 ++++++++++++++++++++++++++++++------- website/openapi_v2.yaml | 202 +++++++++++++++++++++++++++++------- 2 files changed, 338 insertions(+), 68 deletions(-) diff --git a/website/openapi_v2.en.yaml b/website/openapi_v2.en.yaml index 9749c8dee..46318ae8e 100644 --- a/website/openapi_v2.en.yaml +++ b/website/openapi_v2.en.yaml @@ -16423,25 +16423,51 @@ components: description: ISO 3166-1 alpha-3. CustomerUpdateInput: description: On update without createEditLink=true, omitted fields retain their value. A null value clears fields that accept null; an optional field can be omitted without necessarily accepting null. Null is not allowed for legal_name, tax_id, tax_system, or address. For email, phone, and the optional address fields street, exterior, interior, neighborhood, city, municipality, and state, empty or whitespace-only strings normalize to null. Empty postal codes are not accepted. - allOf: - - $ref: '#/components/schemas/CustomerEditableInput' - - type: object + type: object + properties: + legal_name: + type: string + minLength: 1 + description: | + Legal name or business name of the customer. *without* the corporate regime (e.g.: S.A. de C.V.). + example: Dunder Mifflin + tax_id: + type: string + minLength: 1 + example: ABC101010111 + description: | + In Mexican clients, it contains the customer's RFC. For foreigners, it is optional and represents the tax identification number, that is, the equivalent to the RFC in the customer's country. + email: + $ref: '#/components/schemas/CustomerEmailUpdateInput' + phone: *customer_phone + external_id: *customer_external_id_input + default_invoice_use: *customer_default_invoice_use_input + tax_system: + type: string + example: '601' + maxLength: 3 + minLength: 3 + description: | + Required for national clients. Key of the customer's tax regime, from the [Tax Regime Catalog](#tax-regime). + address: + type: object properties: - legal_name: + street: *customer_address_street_input + exterior: *customer_address_exterior_input + interior: *customer_address_interior_input + neighborhood: *customer_address_neighborhood_input + city: *customer_address_city_input + municipality: *customer_address_municipality_input + zip: type: string minLength: 1 - tax_id: + description: Postal code + example: '86500' + state: *customer_address_state_input + country: type: string - minLength: 1 - tax_system: - allOf: - - *customer_tax_system - - type: string - address: - type: object - properties: - country: - type: string + default: MEX + description: ISO 3166-1 alpha-3. CustomerUpdateWithEditLinkInput: description: With createEditLink=true, omitted fields retain their value and null clears the existing value, including fiscal fields. Non-null values must be valid. For email, phone, and the optional address fields street, exterior, interior, neighborhood, city, municipality, and state, empty or whitespace-only strings normalize to null. Empty postal codes are not accepted. type: object @@ -17376,11 +17402,102 @@ components: $ref: "#/components/schemas/InvoiceZipRequest" Invoice: title: Invoice - oneOf: - - $ref: '#/components/schemas/InvoiceStamped' - - $ref: '#/components/schemas/InvoiceDraft' - - $ref: '#/components/schemas/InvoicePending' - - $ref: '#/components/schemas/InvoiceFailed' + allOf: + - $ref: '#/components/schemas/ResourceAutoGeneratedProps' + - $ref: '#/components/schemas/InvoiceCommonProperties' + - anyOf: + - title: Stamped + type: object + required: [date, status, uuid, stamp] + properties: + status: + type: string + enum: [valid, canceled] + date: + type: string + format: date-time + uuid: + type: string + format: uuid + stamp: + type: object + description: Information about the digital fiscal stamp added by the PAC. + required: [date, sat_signature, sat_cert_number, signature, complement_string] + properties: + signature: + type: string + description: Digital stamp of the fiscal document. + date: + type: string + description: "SAT FechaTimbrado: local date and time without a timezone offset. Preserved as text." + example: "2026-09-17T06:59:16" + complement_string: + type: string + description: Original string of the fiscal stamp. + rfc_provider_cert: + type: string + description: Tax ID of the provider that certified the document. + sat_cert_number: + type: string + description: SAT certificate serial number used for stamping. + sat_signature: + type: string + description: Digital stamp of the fiscal document. + - title: Draft + type: object + required: [date, status] + properties: + status: + type: string + const: draft + date: + type: [string, 'null'] + format: date-time + description: Issue date in ISO8601 format. May be null for drafts. + uuid: + type: 'null' + stamp: + type: 'null' + - title: Pending + type: object + required: [date, status] + properties: + status: + type: string + const: pending + date: + type: [string, 'null'] + format: date-time + description: Issue date in ISO8601 format. May be null for drafts. + uuid: + type: [string, 'null'] + format: uuid + description: Fiscal folio of the invoice, assigned by the SAT. For unstamped drafts it can be null or omitted. + example: 39c85a3f-275b-4341-b259-e8971d9f8a94 + stamp: + anyOf: + - $ref: '#/components/schemas/Stamp' + - type: 'null' + - title: Failed + type: object + required: [date, status] + properties: + status: + type: string + const: failed + date: + type: [string, 'null'] + format: date-time + description: Issue date in ISO8601 format. May be null for drafts. + uuid: + type: [string, 'null'] + format: uuid + description: Fiscal folio of the invoice, assigned by the SAT. For unstamped drafts it can be null or omitted. + example: 39c85a3f-275b-4341-b259-e8971d9f8a94 + stamp: + anyOf: + - $ref: '#/components/schemas/Stamp' + - type: 'null' InvoiceStamped: title: Stamped allOf: @@ -17399,12 +17516,29 @@ components: type: string format: uuid stamp: - allOf: - - $ref: '#/components/schemas/Stamp' + type: object + description: Information about the digital fiscal stamp added by the PAC. required: [date, sat_signature, sat_cert_number, signature, complement_string] properties: + signature: + type: string + description: Digital stamp of the fiscal document. + date: + type: string + description: "SAT FechaTimbrado: local date and time without a timezone offset. Preserved as text." + example: "2026-09-17T06:59:16" complement_string: type: string + description: Original string of the fiscal stamp. + rfc_provider_cert: + type: string + description: Tax ID of the provider that certified the document. + sat_cert_number: + type: string + description: SAT certificate serial number used for stamping. + sat_signature: + type: string + description: Digital stamp of the fiscal document. InvoicePending: title: Pending allOf: @@ -17431,7 +17565,7 @@ components: required: [status] properties: status: - $ref: '#/components/schemas/InvoiceCommonProperties/properties/cancellation_status' + $ref: '#/components/schemas/InvoiceCancellationStatus' requested_at: type: string format: date-time @@ -17451,6 +17585,18 @@ components: type: string format: uuid description: UUID of the replacement invoice, when applicable. + InvoiceCancellationStatus: + type: string + enum: + - none + - verifying + - pending + - accepted + - rejected + - expired + description: | + Current status of the cancellation request, if it has been made. `verifying` means the SAT has received the request and is validating it; Facturapi will keep checking until it changes to a final status. You can read more in the [Cancel Invoice](#tag/invoice/operation/deleteInvoice) section. + example: none InvoiceDraft: title: Invoice object with draft status allOf: @@ -17506,17 +17652,7 @@ components: cancellation: $ref: '#/components/schemas/InvoiceCancellation' cancellation_status: - type: string - enum: - - none - - verifying - - pending - - accepted - - rejected - - expired - description: | - Current status of the cancellation request, if it has been made. `verifying` means the SAT has received the request and is validating it; Facturapi will keep checking until it changes to a final status. You can read more in the [Cancel Invoice](#tag/invoice/operation/deleteInvoice) section. - example: none + $ref: '#/components/schemas/InvoiceCancellationStatus' canceled_at: type: - string diff --git a/website/openapi_v2.yaml b/website/openapi_v2.yaml index 2249e199d..591aa9671 100644 --- a/website/openapi_v2.yaml +++ b/website/openapi_v2.yaml @@ -16423,25 +16423,49 @@ components: description: ISO 3166-1 alpha-3. CustomerUpdateInput: description: En una actualización sin createEditLink=true, los campos omitidos conservan su valor. Un valor null borra los campos que admiten null; un campo opcional puede omitirse sin que necesariamente admita null. No se permite null en legal_name, tax_id, tax_system ni address. En email, phone y los campos opcionales street, exterior, interior, neighborhood, city, municipality y state del domicilio, una cadena vacía o sólo espacios se normaliza a null. El código postal vacío no se acepta. - allOf: - - $ref: '#/components/schemas/CustomerEditableInput' - - type: object + type: object + properties: + legal_name: + type: string + minLength: 1 + description: | + Nombre Fiscal o Razón Social del cliente. *sin* el régimen societario (ej.: S.A. de C.V.). + example: Dunder Mifflin + tax_id: + type: string + minLength: 1 + example: ABC101010111 + description: En clientes de México contiene el RFC del cliente. Para extranjeros es opcional y representa el número de registro de identificación tributaria, es decir, el equivalente al RFC en el país del cliente. + email: + $ref: '#/components/schemas/CustomerEmailUpdateInput' + phone: *customer_phone + external_id: *customer_external_id_input + default_invoice_use: *customer_default_invoice_use_input + tax_system: + type: string + example: '601' + maxLength: 3 + minLength: 3 + description: Requerido para clientes nacionales. Clave del régimen fiscal del cliente, del catálogo de [Regímenes Fiscales](#r%C3%A9gimen-fiscal). + address: + type: object properties: - legal_name: + street: *customer_address_street_input + exterior: *customer_address_exterior_input + interior: *customer_address_interior_input + neighborhood: *customer_address_neighborhood_input + city: *customer_address_city_input + municipality: *customer_address_municipality_input + zip: type: string minLength: 1 - tax_id: + description: Código postal + example: '86500' + state: *customer_address_state_input + country: type: string - minLength: 1 - tax_system: - allOf: - - *customer_tax_system - - type: string - address: - type: object - properties: - country: - type: string + default: MEX + description: ISO 3166-1 alpha-3. CustomerUpdateWithEditLinkInput: description: Con createEditLink=true, los campos omitidos conservan su valor y null borra el valor existente, incluidos los datos fiscales. Los valores no nulos deben ser válidos. En email, phone y los campos opcionales street, exterior, interior, neighborhood, city, municipality y state del domicilio, una cadena vacía o sólo espacios se normaliza a null. El código postal vacío no se acepta. type: object @@ -17330,11 +17354,102 @@ components: $ref: "#/components/schemas/InvoiceZipRequest" Invoice: title: Invoice - oneOf: - - $ref: '#/components/schemas/InvoiceStamped' - - $ref: '#/components/schemas/InvoiceDraft' - - $ref: '#/components/schemas/InvoicePending' - - $ref: '#/components/schemas/InvoiceFailed' + allOf: + - $ref: '#/components/schemas/ResourceAutoGeneratedProps' + - $ref: '#/components/schemas/InvoiceCommonProperties' + - anyOf: + - title: Timbrada + type: object + required: [date, status, uuid, stamp] + properties: + status: + type: string + enum: [valid, canceled] + date: + type: string + format: date-time + uuid: + type: string + format: uuid + stamp: + type: object + description: Información sobre el timbre fiscal digital agregado por el PAC. + required: [date, sat_signature, sat_cert_number, signature, complement_string] + properties: + signature: + type: string + description: Sello digital del comprobante fiscal. + date: + type: string + description: "FechaTimbrado del SAT: fecha y hora local sin offset de zona horaria. Se conserva como texto." + example: "2026-09-17T06:59:16" + complement_string: + type: string + description: Cadena original del timbre fiscal digital. + rfc_provider_cert: + type: string + description: RFC del proveedor que certificó el comprobante. + sat_cert_number: + type: string + description: Número de serie del certificado del SAT usado para timbrar. + sat_signature: + type: string + description: Sello digital del timbre fiscal digital. + - title: Borrador + type: object + required: [date, status] + properties: + status: + type: string + const: draft + date: + type: [string, 'null'] + format: date-time + description: Fecha de expedición en formato ISO8601. Puede ser null en borradores. + uuid: + type: 'null' + stamp: + type: 'null' + - title: Pendiente + type: object + required: [date, status] + properties: + status: + type: string + const: pending + date: + type: [string, 'null'] + format: date-time + description: Fecha de expedición en formato ISO8601. Puede ser null en borradores. + uuid: + type: [string, 'null'] + format: uuid + description: Folio fiscal de la factura, asignado por el SAT. En borradores sin timbrar puede ser null o estar omitido. + example: 39c85a3f-275b-4341-b259-e8971d9f8a94 + stamp: + anyOf: + - $ref: '#/components/schemas/Stamp' + - type: 'null' + - title: Fallida + type: object + required: [date, status] + properties: + status: + type: string + const: failed + date: + type: [string, 'null'] + format: date-time + description: Fecha de expedición en formato ISO8601. Puede ser null en borradores. + uuid: + type: [string, 'null'] + format: uuid + description: Folio fiscal de la factura, asignado por el SAT. En borradores sin timbrar puede ser null o estar omitido. + example: 39c85a3f-275b-4341-b259-e8971d9f8a94 + stamp: + anyOf: + - $ref: '#/components/schemas/Stamp' + - type: 'null' InvoiceStamped: title: Timbrada allOf: @@ -17353,12 +17468,29 @@ components: type: string format: uuid stamp: - allOf: - - $ref: '#/components/schemas/Stamp' + type: object + description: Información sobre el timbre fiscal digital agregado por el PAC. required: [date, sat_signature, sat_cert_number, signature, complement_string] properties: + signature: + type: string + description: Sello digital del comprobante fiscal. + date: + type: string + description: "FechaTimbrado del SAT: fecha y hora local sin offset de zona horaria. Se conserva como texto." + example: "2026-09-17T06:59:16" complement_string: type: string + description: Cadena original del timbre fiscal digital. + rfc_provider_cert: + type: string + description: RFC del proveedor que certificó el comprobante. + sat_cert_number: + type: string + description: Número de serie del certificado del SAT usado para timbrar. + sat_signature: + type: string + description: Sello digital del timbre fiscal digital. InvoicePending: title: Pendiente allOf: @@ -17385,7 +17517,7 @@ components: required: [status] properties: status: - $ref: '#/components/schemas/InvoiceCommonProperties/properties/cancellation_status' + $ref: '#/components/schemas/InvoiceCancellationStatus' requested_at: type: string format: date-time @@ -17405,6 +17537,18 @@ components: type: string format: uuid description: UUID de la factura sustituta, cuando aplica. + InvoiceCancellationStatus: + type: string + enum: + - none + - pending + - accepted + - rejected + - expired + - verifying + description: | + Estado actual de la solicitud de cancelación, en caso de haberla realizado. Puedes leer más a detalle en la sección de [Cancelar Factura](#tag/invoice/operation/deleteInvoice)). + example: none InvoiceDraft: title: Objeto Invoice con status draft allOf: @@ -17460,17 +17604,7 @@ components: cancellation: $ref: '#/components/schemas/InvoiceCancellation' cancellation_status: - type: string - enum: - - none - - pending - - accepted - - rejected - - expired - - verifying - description: | - Estado actual de la solicitud de cancelación, en caso de haberla realizado. Puedes leer más a detalle en la sección de [Cancelar Factura](#tag/invoice/operation/deleteInvoice)). - example: none + $ref: '#/components/schemas/InvoiceCancellationStatus' canceled_at: type: - string From 3b5f45f4e200757a4cd39800e6280b8a4eaaec64 Mon Sep 17 00:00:00 2001 From: javorosas Date: Tue, 20 Oct 2026 20:15:47 +0200 Subject: [PATCH 5/5] fix: avoid duplicate reference builds and clarify customer choices --- website/docusaurus.config.js | 2 -- website/package.json | 2 +- website/src/css/custom.css | 7 +++++++ website/src/pages/api.tsx | 27 ++++++++++++++++++++++++++- website/static/api-en/index.html | 11 +++++++++++ website/static/api-es/index.html | 11 +++++++++++ 6 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 website/static/api-en/index.html create mode 100644 website/static/api-es/index.html diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 709f1f74f..7ed3b70f9 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -46,12 +46,10 @@ const darkCodeTheme = require("prism-react-renderer").themes.dracula; specs: [ { id: "api-es", - route: "/api-es", spec: 'openapi_v2.yaml', }, { id: "api-en", - route: "/api-en", spec: 'openapi_v2.en.yaml', }, ], diff --git a/website/package.json b/website/package.json index a37eee993..f793076ba 100644 --- a/website/package.json +++ b/website/package.json @@ -5,7 +5,7 @@ "scripts": { "docusaurus": "docusaurus", "start": "docusaurus start", - "build": "NODE_OPTIONS=--max-old-space-size=6144 docusaurus build", + "build": "docusaurus build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "clear": "docusaurus clear", diff --git a/website/src/css/custom.css b/website/src/css/custom.css index 69d27e296..55935fba4 100644 --- a/website/src/css/custom.css +++ b/website/src/css/custom.css @@ -525,3 +525,10 @@ html[data-theme='dark'] .redocusaurus div[aria-hidden='false'] [tabindex='0'] { margin-bottom: 0.75rem; } } + +/* The customer selectors already name each alternative. */ +[id='operation/createInvoice'] tr:has(> td[title='customer']) > td + td > div > div:first-child, +[id='operation/createInvoice'] tr:has(> td[title='customer']) + tr > td > div > div > span:first-child, +[id='operation/createInvoice'] tr:has(> td[title='customer']) + tr > td > div > div > div > span:first-child { + display: none; +} diff --git a/website/src/pages/api.tsx b/website/src/pages/api.tsx index a5c9eec96..90e65d814 100644 --- a/website/src/pages/api.tsx +++ b/website/src/pages/api.tsx @@ -10,6 +10,31 @@ function CustomPage() { const specData = useSpecData(`api-${locale}`); const displaySpecData = useMemo(() => { const spec = structuredClone(specData.spec); + // Presentation labels do not change the downloadable API contract. + spec.components.schemas.InvoiceCustomerInput.oneOf = [ + { + ...spec.components.schemas.CustomerCreateInput, + title: locale === 'es' ? 'Datos del cliente' : 'Customer details', + anyOf: spec.components.schemas.CustomerCreateInput.anyOf.map( + (variant: object, index: number) => ({ + ...variant, + title: (locale === 'es' + ? ['Nacional', 'Extranjero', 'Público en general'] + : ['Mexican customer', 'Foreign customer', 'General public'])[index], + }), + ), + }, + { + ...spec.components.schemas.InvoiceCustomerInput.oneOf[1], + title: locale === 'es' ? 'Cliente registrado' : 'Registered customer', + }, + ]; + spec.components.schemas.InvoiceCommonInput.allOf[0].properties.customer = { + ...spec.components.schemas.InvoiceCustomerInput, + description: locale === 'es' + ? 'Datos del cliente o ID de un cliente registrado.' + : 'Customer details or the ID of a registered customer.', + }; // ReDoc needs named discriminator variants to render a status selector. // Keep this presentation hint out of the contract: status may be omitted. spec.components.schemas.InvoiceCreateInput.oneOf = @@ -30,7 +55,7 @@ function CustomPage() { }, ); return {...specData, spec}; - }, [specData]); + }, [specData, locale]); return ( + + + + + + API reference + + +API reference + diff --git a/website/static/api-es/index.html b/website/static/api-es/index.html new file mode 100644 index 000000000..5dc33d943 --- /dev/null +++ b/website/static/api-es/index.html @@ -0,0 +1,11 @@ + + + + + + + Referencia API + + +Referencia API +