mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 20:47:44 +00:00
Added test to validate nested files work
Should catch any regressions made. Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -1310,3 +1310,19 @@ x-string: test`)
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
name: page-size
|
||||
description: Specify the number of results to return per page.
|
||||
in: header
|
||||
schema:
|
||||
type: integer
|
||||
@@ -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
|
||||
@@ -0,0 +1,6 @@
|
||||
name: AccountModel
|
||||
description: TODO
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../schemas/AccountModel.yaml
|
||||
@@ -0,0 +1,5 @@
|
||||
description: Unspecified 200 success object response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
73
test_specs/nested_files/components/schemas/AccountModel.yaml
Normal file
73
test_specs/nested_files/components/schemas/AccountModel.yaml
Normal 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
|
||||
21
test_specs/nested_files/openapi.yaml
Normal file
21
test_specs/nested_files/openapi.yaml
Normal 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"
|
||||
42
test_specs/nested_files/paths/v1_Accounts.yaml
Normal file
42
test_specs/nested_files/paths/v1_Accounts.yaml
Normal 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
|
||||
Reference in New Issue
Block a user