diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir-in-memory/examples-null-values.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir-in-memory/examples-null-values.json new file mode 100644 index 00000000000..dc80295ce3e --- /dev/null +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir-in-memory/examples-null-values.json @@ -0,0 +1,147 @@ +{ + "type": "openapi", + "value": { + "openapi": "3.1.0", + "info": { + "title": "Readonly Properties API", + "version": "1.0.0" + }, + "paths": { + "/users": { + "post": { + "summary": "Create a user", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserCreate" + } + } + } + }, + "responses": { + "200": { + "description": "User created successfully", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + }, + "examples": { + "example1": { + "value": { + "id": "123", + "name": "John Doe", + "email": "john.doe@example.com", + "createdAt": "2021-01-01T00:00:00Z", + "settings": { + "theme": "light", + "notifications": true, + "lastModified": "2021-01-01T00:00:00Z" + } + } + }, + "example2": { + "value": { + "id": "1234", + "name": "John Doe", + "email": null, + "createdAt": "2021-01-01T00:00:00Z", + "settings": { + "theme": "dark", + "notifications": false, + "lastModified": "2021-01-01T00:00:00Z" + } + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "UserCreate": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "settings": { + "$ref": "#/components/schemas/UserSettings" + } + } + }, + "User": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": [ + "string", + "null" + ] + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "settings": { + "$ref": "#/components/schemas/UserSettings" + }, + "stats": { + "$ref": "#/components/schemas/UserStats" + } + } + }, + "UserSettings": { + "type": "object", + "properties": { + "theme": { + "type": "string" + }, + "notifications": { + "type": "boolean" + }, + "lastModified": { + "type": "string", + "format": "date-time" + } + } + }, + "UserStats": { + "type": "object", + "properties": { + "totalLogins": { + "type": "integer" + }, + "lastLoginTime": { + "type": "string", + "format": "date-time" + }, + "accountStatus": { + "type": "string", + "enum": [ + "active", + "suspended", + "deleted" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/examples-null-values.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/examples-null-values.json new file mode 100644 index 00000000000..2ddbfc1043f --- /dev/null +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/examples-null-values.json @@ -0,0 +1,547 @@ +{ + "title": "Readonly Properties API", + "servers": [], + "tags": { + "tagsById": {} + }, + "hasEndpointsMarkedInternal": false, + "endpoints": [ + { + "summary": "Create a user", + "audiences": [], + "tags": [], + "pathParameters": [], + "queryParameters": [], + "headers": [], + "generatedRequestName": "PostUsersRequest", + "request": { + "schema": { + "generatedName": "PostUsersRequest", + "schema": "UserCreate", + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "type": "reference" + }, + "contentType": "application/json", + "fullExamples": [], + "additionalProperties": false, + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "type": "json" + }, + "response": { + "description": "User created successfully", + "schema": { + "generatedName": "PostUsersResponse", + "schema": "User", + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "type": "reference" + }, + "fullExamples": [], + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "statusCode": 200, + "type": "json" + }, + "errors": {}, + "server": [], + "authed": false, + "method": "POST", + "path": "/users", + "examples": [ + { + "pathParameters": [], + "queryParameters": [], + "headers": [], + "request": { + "properties": {}, + "type": "object" + }, + "response": { + "value": { + "properties": { + "id": { + "value": { + "value": "id", + "type": "string" + }, + "type": "primitive" + }, + "name": { + "value": { + "value": "name", + "type": "string" + }, + "type": "primitive" + }, + "email": { + "value": { + "value": "email", + "type": "string" + }, + "type": "primitive" + }, + "createdAt": { + "value": { + "value": "2024-01-15T09:30:00Z", + "type": "datetime" + }, + "type": "primitive" + }, + "settings": { + "properties": { + "theme": { + "value": { + "value": "theme", + "type": "string" + }, + "type": "primitive" + }, + "notifications": { + "value": { + "value": true, + "type": "boolean" + }, + "type": "primitive" + }, + "lastModified": { + "value": { + "value": "2024-01-15T09:30:00Z", + "type": "datetime" + }, + "type": "primitive" + } + }, + "type": "object" + }, + "stats": { + "properties": { + "totalLogins": { + "value": { + "value": 1, + "type": "int" + }, + "type": "primitive" + }, + "lastLoginTime": { + "value": { + "value": "2024-01-15T09:30:00Z", + "type": "datetime" + }, + "type": "primitive" + }, + "accountStatus": { + "value": "active", + "type": "enum" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "type": "withoutStreaming" + }, + "codeSamples": [], + "type": "full" + } + ], + "source": { + "file": "../openapi.yml", + "type": "openapi" + } + } + ], + "webhooks": [], + "channel": [], + "groupedSchemas": { + "rootSchemas": { + "UserCreate": { + "allOf": [], + "properties": [ + { + "conflict": {}, + "generatedName": "userCreateName", + "key": "name", + "schema": { + "generatedName": "userCreateName", + "value": { + "schema": { + "type": "string" + }, + "generatedName": "UserCreateName", + "groupName": [], + "type": "primitive" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + }, + { + "conflict": {}, + "generatedName": "userCreateEmail", + "key": "email", + "schema": { + "generatedName": "userCreateEmail", + "value": { + "schema": { + "type": "string" + }, + "generatedName": "UserCreateEmail", + "groupName": [], + "type": "primitive" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + }, + { + "conflict": {}, + "generatedName": "userCreateSettings", + "key": "settings", + "schema": { + "generatedName": "userCreateSettings", + "value": { + "generatedName": "UserCreateSettings", + "schema": "UserSettings", + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "type": "reference" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [], + "readonly": false + } + ], + "allOfPropertyConflicts": [], + "generatedName": "UserCreate", + "groupName": [], + "additionalProperties": false, + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "type": "object" + }, + "User": { + "allOf": [], + "properties": [ + { + "conflict": {}, + "generatedName": "userId", + "key": "id", + "schema": { + "generatedName": "userId", + "value": { + "schema": { + "type": "string" + }, + "generatedName": "UserId", + "groupName": [], + "type": "primitive" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + }, + { + "conflict": {}, + "generatedName": "userName", + "key": "name", + "schema": { + "generatedName": "userName", + "value": { + "schema": { + "type": "string" + }, + "generatedName": "UserName", + "groupName": [], + "type": "primitive" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + }, + { + "conflict": {}, + "generatedName": "userEmail", + "key": "email", + "schema": { + "generatedName": "userEmail", + "value": { + "generatedName": "UserEmail", + "value": { + "schema": { + "type": "string" + }, + "generatedName": "UserEmail", + "groupName": [], + "type": "primitive" + }, + "groupName": [], + "type": "nullable" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + }, + { + "conflict": {}, + "generatedName": "userCreatedAt", + "key": "createdAt", + "schema": { + "generatedName": "userCreatedAt", + "value": { + "schema": { + "type": "datetime" + }, + "generatedName": "UserCreatedAt", + "groupName": [], + "type": "primitive" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + }, + { + "conflict": {}, + "generatedName": "userSettings", + "key": "settings", + "schema": { + "generatedName": "userSettings", + "value": { + "generatedName": "UserSettings", + "schema": "UserSettings", + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "type": "reference" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [], + "readonly": false + }, + { + "conflict": {}, + "generatedName": "userStats", + "key": "stats", + "schema": { + "generatedName": "userStats", + "value": { + "generatedName": "UserStats", + "schema": "UserStats", + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "type": "reference" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [], + "readonly": false + } + ], + "allOfPropertyConflicts": [], + "generatedName": "User", + "groupName": [], + "additionalProperties": false, + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "type": "object" + }, + "UserSettings": { + "allOf": [], + "properties": [ + { + "conflict": {}, + "generatedName": "userSettingsTheme", + "key": "theme", + "schema": { + "generatedName": "userSettingsTheme", + "value": { + "schema": { + "type": "string" + }, + "generatedName": "UserSettingsTheme", + "groupName": [], + "type": "primitive" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + }, + { + "conflict": {}, + "generatedName": "userSettingsNotifications", + "key": "notifications", + "schema": { + "generatedName": "userSettingsNotifications", + "value": { + "schema": { + "type": "boolean" + }, + "generatedName": "UserSettingsNotifications", + "groupName": [], + "type": "primitive" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + }, + { + "conflict": {}, + "generatedName": "userSettingsLastModified", + "key": "lastModified", + "schema": { + "generatedName": "userSettingsLastModified", + "value": { + "schema": { + "type": "datetime" + }, + "generatedName": "UserSettingsLastModified", + "groupName": [], + "type": "primitive" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + } + ], + "allOfPropertyConflicts": [], + "generatedName": "UserSettings", + "groupName": [], + "additionalProperties": false, + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "type": "object" + }, + "UserStats": { + "allOf": [], + "properties": [ + { + "conflict": {}, + "generatedName": "userStatsTotalLogins", + "key": "totalLogins", + "schema": { + "generatedName": "userStatsTotalLogins", + "value": { + "schema": { + "type": "int" + }, + "generatedName": "UserStatsTotalLogins", + "groupName": [], + "type": "primitive" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + }, + { + "conflict": {}, + "generatedName": "userStatsLastLoginTime", + "key": "lastLoginTime", + "schema": { + "generatedName": "userStatsLastLoginTime", + "value": { + "schema": { + "type": "datetime" + }, + "generatedName": "UserStatsLastLoginTime", + "groupName": [], + "type": "primitive" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + }, + { + "conflict": {}, + "generatedName": "userStatsAccountStatus", + "key": "accountStatus", + "schema": { + "generatedName": "userStatsAccountStatus", + "value": { + "generatedName": "UserStatsAccountStatus", + "values": [ + { + "generatedName": "active", + "value": "active", + "casing": {} + }, + { + "generatedName": "suspended", + "value": "suspended", + "casing": {} + }, + { + "generatedName": "deleted", + "value": "deleted", + "casing": {} + } + ], + "groupName": [], + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "type": "enum" + }, + "groupName": [], + "type": "optional" + }, + "audiences": [] + } + ], + "allOfPropertyConflicts": [], + "generatedName": "UserStats", + "groupName": [], + "additionalProperties": false, + "source": { + "file": "../openapi.yml", + "type": "openapi" + }, + "type": "object" + } + }, + "namespacedSchemas": {} + }, + "variables": {}, + "nonRequestReferencedSchemas": {}, + "securitySchemes": {}, + "globalHeaders": [], + "idempotencyHeaders": [], + "groups": {} +} \ No newline at end of file