Skip to content

Commit

Permalink
fix(cli): openapi importer respects examples when additionalProperties (
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi authored Jan 3, 2025
1 parent 557e276 commit c963016
Show file tree
Hide file tree
Showing 8 changed files with 950 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,36 @@ export class ExampleTypeFactory {
result[property] = propertyExample;
}
}
if (schema.additionalProperties) {
for (const [property, value] of Object.entries(fullExample)) {
if (!(property in result)) {
const propertyExample = this.buildExampleHelper({
schema: SchemaWithExample.unknown({
example: value,
title: undefined,
availability: undefined,
description: undefined,
generatedName: "",
nameOverride: undefined,
groupName: undefined
}),
exampleId,
example: value,
visitedSchemaIds,
depth: depth + 1,
options: {
...options,
name: property
},
skipReadonly
});
if (propertyExample != null) {
result[property] = propertyExample;
}
}
}
}

return FullExample.object({
properties: result
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70135,6 +70135,7 @@ client.connect()
},
"tipo_declaracion": "Normal",
},
"link": "19697249-01b8-443e-a451-76bfc5fbeebf",
"pdf": "=PDF-STRING=",
"receipt_pdf": "=PDF-STRING=",
},
Expand Down Expand Up @@ -70505,6 +70506,9 @@ client.connect()
"body": {
"count": 101,
"next": "https://sandbox.belvo.com/api/{endpoint}/?page=2",
"previous": {
"key": "value",
},
"results": [
{
"collected_at": "2022-02-09T08:45:50Z",
Expand Down Expand Up @@ -70622,6 +70626,7 @@ client.connect()
"pagos_provisionales": 0,
"titular_clabe_permite_verificacion": "SÍ",
},
"dividendos": {},
"id": "02589c41-ba22-4d44-8558-8111cc751318",
"informacion_general": {
"ejercicio": 2018,
Expand Down Expand Up @@ -70701,6 +70706,7 @@ client.connect()
],
"subsidio_empleo": 0,
},
"type": "yearly",
},
],
},
Expand Down Expand Up @@ -70810,11 +70816,15 @@ client.connect()
"body": {
"count": 101,
"next": "https://sandbox.belvo.com/api/{endpoint}/?page=2",
"previous": {
"key": "value",
},
"results": [
{
"collected_at": "2022-02-09T08:45:50Z",
"created_at": "2022-02-09T08:46:20Z",
"id": "0d3ffb69-f83b-456e-ad8e-208d0998d71d",
"informacion_general": {},
"isr": {
"detalle_del_pago": {
"a_cargo": 0,
Expand Down Expand Up @@ -70969,11 +70979,15 @@ client.connect()
"body": {
"count": 101,
"next": "https://sandbox.belvo.com/api/{endpoint}/?page=2",
"previous": {
"key": "value",
},
"results": [
{
"collected_at": "2022-02-09T08:45:50Z",
"created_at": "2022-02-09T08:46:20Z",
"id": "0d3ffb69-f83b-456e-ad8e-208d0998d71d",
"informacion_general": {},
"isr": {
"detalle_del_pago": {
"a_cargo": 0,
Expand Down Expand Up @@ -71136,6 +71150,9 @@ client.connect()
"body": {
"count": 101,
"next": "https://sandbox.belvo.com/api/{endpoint}/?page=2",
"previous": {
"key": "value",
},
"results": [
{
"cifras_cierre_ejercicio": {
Expand Down Expand Up @@ -71217,6 +71234,7 @@ client.connect()
"utilidad_o_perdida_fiscal_antes_de_ptu": 416134,
},
},
"dividendos_o_utilidades_distribuidos": {},
"estado_posicion_financiera_balance": {
"activo": {
"cargos_y_gastos_diferidos": 9319,
Expand Down Expand Up @@ -71297,8 +71315,10 @@ client.connect()
"rfc": "ABC1111111A1",
"tipo_declaracion": "Normal",
},
"link": "19697249-01b8-443e-a451-76bfc5fbeebf",
"pdf": "=PDF-STRING=",
"receipt_pdf": "=PDF-STRING=",
"type": "yearly",
},
],
},
Expand Down Expand Up @@ -71408,6 +71428,9 @@ client.connect()
"body": {
"count": 101,
"next": "https://sandbox.belvo.com/api/{endpoint}/?page=2",
"previous": {
"key": "value",
},
"results": [
{
"collected_at": "2022-02-09T08:45:50Z",
Expand Down Expand Up @@ -73114,6 +73137,7 @@ client.connect()
},
"tipo_declaracion": "Normal",
},
"link": "19697249-01b8-443e-a451-76bfc5fbeebf",
"pdf": "=PDF-STRING=",
"receipt_pdf": "=PDF-STRING=",
},
Expand Down Expand Up @@ -73849,6 +73873,10 @@ service:
saldo_credito_fiscal_anteriores_produccion_distribucion_cinematografica: 0
pdf: '=PDF-STRING='
receipt_pdf: '=PDF-STRING='
dividendos: {}
type: yearly
previous:
key: value
code-samples:
- language: cURL
code: |
Expand Down Expand Up @@ -73986,6 +74014,9 @@ service:
pdf: '===PDF_BINARY===='
receipt_pdf: '===PDF_BINARY===='
type: monthly
informacion_general: {}
previous:
key: value
code-samples:
- language: cURL
code: |
Expand Down Expand Up @@ -74131,6 +74162,9 @@ service:
pdf: '===PDF_BINARY===='
receipt_pdf: '===PDF_BINARY===='
type: monthly
informacion_general: {}
previous:
key: value
code-samples:
- language: cURL
code: |
Expand Down Expand Up @@ -74368,6 +74402,11 @@ service:
cantidad_a_pagar: 113002
pdf: '=PDF-STRING='
receipt_pdf: '=PDF-STRING='
link: 19697249-01b8-443e-a451-76bfc5fbeebf
dividendos_o_utilidades_distribuidos: {}
type: yearly
previous:
key: value
code-samples:
- language: cURL
code: |
Expand Down Expand Up @@ -74578,6 +74617,8 @@ service:
pdf: '===PDF_BINARY===='
receipt_pdf: '===PDF_BINARY===='
type: monthly
previous:
key: value
code-samples:
- language: cURL
code: |
Expand Down Expand Up @@ -75712,6 +75753,7 @@ service:
cantidad_a_pagar: 113002
pdf: '=PDF-STRING='
receipt_pdf: '=PDF-STRING='
link: 19697249-01b8-443e-a451-76bfc5fbeebf
code-samples:
- language: cURL
code: |-
Expand Down Expand Up @@ -76950,6 +76992,7 @@ service:
cantidad_a_pagar: 113002
pdf: '=PDF-STRING='
receipt_pdf: '=PDF-STRING='
link: 19697249-01b8-443e-a451-76bfc5fbeebf
code-samples:
- language: cURL
code: |
Expand Down
Loading

0 comments on commit c963016

Please sign in to comment.