# Compatibility with the official SDKs

The Elixir SDK uses Req for HTTP. Its API catalog comes from the pinned OpenAPI
contract. The official SDK source and tests supplied examples for authentication,
filtering, and HTTP serialization.

- [OpenAPI specification at `362e3fe`](https://github.com/fattureincloud/openapi-fattureincloud/tree/362e3fe524ca5a8cd8b79efdf036c464c16c5c42)
- [Go SDK at `e424718`](https://github.com/fattureincloud/fattureincloud-go-sdk/tree/e424718947f265f90bd6e24375f4b2edfc85e65e)
- [TypeScript SDK at `339771d`](https://github.com/fattureincloud/fattureincloud-ts-sdk/tree/339771d28d0d28fef93149e7dab81552bd2a98b3)
- [JavaScript SDK at `439192a`](https://github.com/fattureincloud/fattureincloud-js-sdk/tree/439192ae97720105aa2fcff603a2a2f81191dad0)

| Behavior | Upstream reference | Elixir tests |
| --- | --- | --- |
| Configurable Go SDK User-Agent | Go `api/configuration.go` | `transport_test.exs` |
| Bearer authorization and encoded path parameters | Go `api/client.go`, TypeScript `src/api/*` | `transport_test.exs`, `contract_test.exs` |
| JSON code exchange and refresh, with a client secret for Authorization Code Flow | Go `oauth2/oauth2_authorization_code.go`, TypeScript `src/oauth2/oauth2-authorization-code-manager.ts` | `oauth_test.exs` |
| Device code inside `data` and device refresh without a client secret | Go `oauth2/oauth2_device_code.go`, TypeScript `src/oauth2/oauth2-device-code-manager.ts` | `oauth_test.exs` |
| Flat OAuth responses and `error_description` | Go `oauth2/oauth2.go`, TypeScript OAuth manager, provider guides | `oauth_test.exs` |
| XML preserved as a string | Go `api/client.go`, TypeScript `test/api/IssuedEInvoicesApi.spec.ts` | `transport_test.exs` |
| Null, false, zero, dates, and decimal numbers preserved on the wire | Go `model/*`, TypeScript `test/api/IssuedDocumentsApi.spec.ts` | `transport_test.exs`, `sdk_parity_test.exs` |
| Separate multipart fields for `filename` and `attachment` | TypeScript `src/api/issued-documents-api.ts`, Go attachment API | `contract_test.exs`, `sdk_parity_test.exs` |
| Null, boolean, numeric, and string filters with nested AND/OR | Go `filter/*` and `test/filter/*`, TypeScript `src/filter/*` and `test/filter/*` | `filter_test.exs` |
| Full pagination envelope | TypeScript `test/api/ClientsApi.spec.ts`, OpenAPI | `pagination_test.exs`, `sdk_parity_test.exs` |
| Complete error details, including SdI validation | Go `GenericOpenAPIError`, OpenAPI | `transport_test.exs`, `sdk_parity_test.exs` |

## OpenAPI examples that disagree with their schemas

The pinned contract has 26 JSON media-type examples that contradict their
schemas, including 17 responses and 9 requests. The local experiment report
records the source JSON pointer, operation, outcome, and changed field paths
for each example. [Experiment results](https://github.com/elchemista/ex_fattureincloud/blob/main/test/fixtures/official_sdk_behavior.json)

- **Go.** Each example was decoded with `json.Unmarshal` into its generated
  model and encoded again after a successful decode. Eight decoded successfully
  and 18 were rejected. The SDK uses the same decoder for HTTP JSON.
  [Go decoder](https://github.com/fattureincloud/fattureincloud-go-sdk/blob/e424718947f265f90bd6e24375f4b2edfc85e65e/api/client.go#L534-L545)
- **JavaScript.** `ApiClient.deserialize` constructed a generated model for 24
  examples and failed for two. A separate local HTTP experiment passed the nine
  request objects directly to `ApiClient.callApi` and preserved all nine.
  [JavaScript deserializer](https://github.com/fattureincloud/fattureincloud-js-sdk/blob/439192ae97720105aa2fcff603a2a2f81191dad0/src/ApiClient.js#L352-L365)
- **TypeScript.** A local Axios adapter ran the generated API methods with
  standard Axios transformations. The transport preserved the JSON in all 17
  responses and all nine requests.
  [TypeScript transport](https://github.com/fattureincloud/fattureincloud-ts-sdk/blob/339771d28d0d28fef93149e7dab81552bd2a98b3/common.ts#L109-L126)

| Examples | Go models | JavaScript models | TypeScript transport |
| --- | --- | --- | --- |
| `createCashbookEntry` response with a numeric ID | Rejects the numeric ID | Converts the ID to a string and the date to a `Date` | Preserves the JSON |
| Numeric VAT `ei_type` in create, modify, and get operations, `getClientInfo`, and `getTaxProfile` | Rejects the number | Converts it to a string | Preserves the JSON |
| `listVatTypes` response with a string `e_invoice` | Rejects the string | Converts it to `true` | Preserves the JSON |
| `getEInvoiceRejectionReason` with a date without a time | Requires an RFC 3339 timestamp | Converts the value to a `Date` | Preserves the string |
| `getIssuedDocumentPreCreateInfo` with `null` numbering | Re-encodes it as zero | Accepts it and may omit unmodeled fields | Preserves all fields and `null` |
| `getReceiptPreCreateInfo` with nested numbering objects | Expects integers | Accepts objects | Preserves the JSON |
| `listClients` with a `null` payment method | Decodes a nil pointer and omits the field on re-encode | Omits the field on re-encode | Preserves the field and `null` |
| `listF24` with a total encoded as a string | Expects a number | Converts it with `parseFloat` | Preserves the string |
| `listPendingReceivedDocuments` with type `expense` | Rejects the enum value | Accepts the value and may omit unmodeled fields | Preserves the JSON |
| `listUserCompanies` with a numeric VAT ID | Expects a string | Converts it to a string | Preserves the number |
| Subscription create, list, and modify with legacy events or string `warnings` | Rejects the enum values and string warnings | Accepts the enum values and fails during `data.map` for both string warnings | Preserves the JSON |
| Cashbook create and modify, issued document create, received document totals, and F24 create and modify with missing required fields | Optional model fields are omitted on re-encode | Constructs models and converts some dates to `Date` | Sends the original JSON |

JavaScript's generic conversion code accounts for the ID and date changes.
Its receipt model explicitly allows object values for receipt numbering.
Go's generated cashbook model has optional fields and a zero-argument
constructor. [JavaScript type conversions](https://github.com/fattureincloud/fattureincloud-js-sdk/blob/439192ae97720105aa2fcff603a2a2f81191dad0/src/ApiClient.js#L527-L555),
[JavaScript receipt model](https://github.com/fattureincloud/fattureincloud-js-sdk/blob/439192ae97720105aa2fcff603a2a2f81191dad0/src/model/ReceiptPreCreateInfo.js#L47-L52),
[Go cashbook model](https://github.com/fattureincloud/fattureincloud-go-sdk/blob/e424718947f265f90bd6e24375f4b2edfc85e65e/model/model_cashbook_entry.go#L22-L48)

The Elixir transport preserves decoded JSON values and unknown fields. The
contract tests use the original schemas, and compatibility tests cover JSON
preservation separately. These experiments ran locally against the pinned
source. Provider acceptance and SdI behavior require a live account.

## Upstream issues and transport regressions

| Upstream report | Recorded behavior | Elixir regression coverage |
| --- | --- | --- |
| [TypeScript #19, empty e-invoice body](https://github.com/fattureincloud/fattureincloud-ts-sdk/issues/19), closed December 5, 2022 | The maintainer reported a service validation change and restoration of the previous behavior. [Maintainer response](https://github.com/fattureincloud/fattureincloud-ts-sdk/issues/19#issuecomment-1309912137) | `nil`, `%{}`, and `%{data: %{}}` are sent as an omitted body, empty object, and empty data envelope, respectively. An SdI submission is sent once. |
| [TypeScript #14, OAuth field names](https://github.com/fattureincloud/fattureincloud-ts-sdk/issues/14), closed September 22, 2022 | The maintainer confirmed a fix for the mismatch between camelCase types and snake_case JSON. [Maintainer response](https://github.com/fattureincloud/fattureincloud-ts-sdk/issues/14#issuecomment-1255134615) | Code exchange and refresh read `access_token`, `refresh_token`, and `expires_in` from Req responses. |
| [TypeScript PR #46, Device Code Flow](https://github.com/fattureincloud/fattureincloud-ts-sdk/pull/46), merged June 17, 2024 | The PR added a device-code manager and corrected access to the response's `data` envelope. | `OAuth.device_code/2` accepts both the enveloped response and the flat response shown in the guides. Polling remains explicit. |
| [JavaScript #80, refresh returned undefined properties](https://github.com/fattureincloud/fattureincloud-js-sdk/issues/80), closed March 7, 2024 | The merged fix awaits the Promise before constructing the result. [PR #82](https://github.com/fattureincloud/fattureincloud-js-sdk/pull/82) | The caller receives the result after the HTTP response. With managed renewal, refreshed credentials are released after a successful save. |
| [TypeScript #55, `Supplier.ei_code`](https://github.com/fattureincloud/fattureincloud-ts-sdk/issues/55) and [JavaScript #114, `merged_in`](https://github.com/fattureincloud/fattureincloud-js-sdk/issues/114), inspected November 17, 2026 | The pinned JavaScript model copies known fields and omits `merged_in`. | The SDK preserves `ei_code` and other fields in request and response maps. |
| [Go PR #46, OAuth helpers and tests](https://github.com/fattureincloud/fattureincloud-go-sdk/pull/46), merged October 17, 2025 | The refactor added local HTTP tests for successful token and device-code requests. | Elixir tests cover successful requests, OAuth errors, expiry, concurrent renewals, persistence failures, and uncertain outcomes. |

## SDK behavior beyond the generated resources

The SDK provides constant-time OAuth state validation, structured errors,
read-only request retries, lazy pagination, live plan quotas, multipart
streaming, and ES256 webhook verification. Filters accept the documented
operators and reject unsupported quoting characters in literal strings.
[Query syntax](https://developers.fattureincloud.it/docs/basics/filter-results/queries/),
[pagination](https://developers.fattureincloud.it/docs/basics/paginate-results/),
[webhook notifications](https://developers.fattureincloud.it/docs/webhooks/notifications/)
