Added test to validate nested files work

Should catch any regressions made.

Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
quobix
2024-02-12 10:44:37 -05:00
parent 974c7bbf49
commit 37975517e0
8 changed files with 176 additions and 0 deletions

View File

@@ -1310,3 +1310,19 @@ x-string: test`)
t.Errorf("expected x-time to be '2020-12-24T12:00:00Z', but got %v", extVal) t.Errorf("expected x-time to be '2020-12-24T12:00:00Z', but got %v", extVal)
} }
} }
func TestDocument_TestNestedFiles(t *testing.T) {
spec, err := os.ReadFile("test_specs/nested_files/openapi.yaml")
require.NoError(t, err)
doc, err := NewDocumentWithConfiguration(spec, &datamodel.DocumentConfiguration{
BasePath: "./test_specs/nested_files",
IgnorePolymorphicCircularReferences: true,
IgnoreArrayCircularReferences: true,
AllowFileReferences: true,
})
require.NoError(t, err)
_, errs := doc.BuildV3Model()
require.Empty(t, errs)
}

View File

@@ -0,0 +1,5 @@
name: page-size
description: Specify the number of results to return per page.
in: header
schema:
type: integer

View File

@@ -0,0 +1,8 @@
name: $select
description: Selects the columns or properties in the result set. This cannot be combined with any other query params!
# https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/query-data-web-api#select-columns
in: query
required: false
schema:
type: string
example: RowId,Description

View File

@@ -0,0 +1,6 @@
name: AccountModel
description: TODO
content:
application/json:
schema:
$ref: ../schemas/AccountModel.yaml

View File

@@ -0,0 +1,5 @@
description: Unspecified 200 success object response
content:
application/json:
schema:
type: object

View File

@@ -0,0 +1,73 @@
type: object
properties:
AccountId:
type: string
description: TODO
Name:
type: string
description: TODO
DepartmentId:
type: string
description: TODO
ForCustomerOperators:
type: boolean
description: TODO
ForPartIssues:
type: boolean
description: TODO
ForPurchaseOrders:
type: boolean
description: TODO
IsActive:
type: boolean
description: TODO
ExternalIdentifier:
type: string
description: TODO
Invalidated:
type: boolean
description: TODO
ExternalEntity:
type: string
description: TODO
ExternalFund:
type: string
description: TODO
ExternalOrganization:
type: string
description: TODO
ExternalAccount:
type: string
description: TODO
ExternalProject:
type: string
description: TODO
ExternalProgram:
type: string
description: TODO
ExternalSource:
type: string
description: TODO
ExternalOther1:
type: string
description: TODO
ExternalOther2:
type: string
description: TODO
SupportsAllTasks:
type: boolean
description: TODO
EnforceTasks:
type: boolean
description: TODO
MobileUniqueId:
format: int32
type: integer
description: TODO
TypeName:
type: string
description: TODO
readOnly: true
UID:
type: string
description: TODO

View File

@@ -0,0 +1,21 @@
---
openapi: 3.0.0
info:
description: Example API spec
version: v1
title: Example
contact:
name: Example
email: example@example.com
url: www.example.com
license:
name: Example
url: www.example.com
tags:
- name: Account
description: Account
servers:
- url: https://<hidden>
paths:
/api/v1/Accounts:
$ref: "paths/v1_Accounts.yaml"

View File

@@ -0,0 +1,42 @@
get:
summary: TODO
description: TODO
security:
- BearerAuth: []
tags:
- Account
operationId: getAccounts
parameters:
- $ref: ../components/parameters/query/$select.yaml
- $ref: ../components/parameters/header/page-size.yaml
responses:
"200":
$ref: ../components/responses/Unspecified200.yaml
post:
summary: TODO
description: TODO
security:
- BearerAuth: []
tags:
- Account
operationId: createAccounts
requestBody:
$ref: ../components/requestBodies/AccountModel.yaml
responses:
"200":
$ref: ../components/responses/Unspecified200.yaml
put:
summary: TODO
description: TODO
security:
- BearerAuth: []
tags:
- Account
operationId: updateAccounts
requestBody:
$ref: ../components/requestBodies/AccountModel.yaml
responses:
"200":
$ref: ../components/responses/Unspecified200.yaml