Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

chore: update test files, fix #102 #120

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
"devDependencies": {
"@changesets/cli": "^2.27.5",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"github-slugger": "^2.0.0",
"lefthook": "^1.6.15",
"prettier": "^3.3.0",
"turbo": "^1.13.3",
"typescript": "^5.4.5",
"vite-node": "^1.6.0",
"vitest": "^1.6.0"
},
"private": true,
Expand Down
32 changes: 6 additions & 26 deletions packages/openapi-parser/tests/diff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ import { describe, expect, test } from 'vitest'
import { AnyObject, normalize, openapi } from '../src'

const expectedErrors = {
// 'packages/openapi-parser/tests/files/airport-webappspotcom.yaml': [
// {
// message: "must have required property 'tokenUrl'",
// },
// ],
'packages/openapi-parser/tests/files/opensuseorgobs.yaml': [
{
message: "must have required property '$ref'",
Expand Down Expand Up @@ -45,33 +40,18 @@ const circularReferences = [

// Just skip some files. If it’s not empty, we’ve got some work to do. :)
const ignoreFiles = [
// Cannot find supported OpenAPI version?
'packages/openapi-parser/tests/files/amadeuscomamadeus-flight-check-in-links.yaml',
// Returns HTML?
'packages/openapi-parser/tests/files/amazonawscombackup.yaml',
'packages/openapi-parser/tests/files/amazonawscomappintegrations.yaml',
// Very slow files
'packages/openapi-parser/tests/files/amazonawscomdynamodb.yaml',
'packages/openapi-parser/tests/files/amazonawscomelasticmapreduce.yaml',
'packages/openapi-parser/tests/files/amazonawscomemr-containers.yaml',
'packages/openapi-parser/tests/files/amazonawscomec2.yaml',
'packages/openapi-parser/tests/files/amazonawscomdynamodb.yaml',
]

const files = (await glob('./packages/openapi-parser/tests/files/*.yaml'))
.filter((file) => !ignoreFiles.includes(file))
// Aphabetic
.sort()
// Random
// .sort(() => Math.random() - 0.5)

// Just test a few files specifically:
// const files = [
// 'packages/openapi-parser/tests/files/xerocomxero_accounting.yaml',
// 'packages/openapi-parser/tests/files/xtrfeu.yaml',
// 'packages/openapi-parser/tests/files/webflowcom.yaml',
// 'packages/openapi-parser/tests/files/amazonawscomathena.yaml',
// 'packages/openapi-parser/tests/files/amazonawscomce.yaml',
// 'packages/openapi-parser/tests/files/amazonawscomconnect.yaml',
// 'packages/openapi-parser/tests/files/opentrialslocal.yaml',
// 'packages/openapi-parser/tests/files/bbccouk.yaml',
// 'packages/openapi-parser/tests/files/ote-godaddycomdomains.yaml',
// 'packages/openapi-parser/tests/files/googleapiscomfirebaserules.yaml',
// ]

/**
* This test suite parses a large number of real-world OpenAPI files
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,271 @@
<!doctype html><html data-color-mode=auto data-light-theme=light data-dark-theme=dark_dimmed><head><title>Rate limit exceeded</title><link href=https://github.github.com/pages-staticassets/primer-tiny.css rel=stylesheet><style>@media (prefers-color-scheme:dark){.gh{filter:brightness(0) saturate(100%) invert(78%) sepia(12%) saturate(315%) hue-rotate(169deg) brightness(95%) contrast(86%)}}</style><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1"></head><body><div><div class="color-bg-primary width-full d-flex flex-column flex-items-center p-6 text-center" style=min-height:100vh><img src=https://github.github.com/pages-staticassets/gh.svg width=48 height=48 class="color-icon-primary octicon gh"><h1 class="f2-light mt-4">Rate limit exceeded</h1><p class=mt-2>Please wait a few minutes before retrying your request.</p><dl class="width-full border color-border-muted color-bg-subtle rounded-2 d-flex flex-column flex-items-center p-3 mt-4" style=max-width:480px><dt class=text-semibold>URL:<dd class=wb-break-all>api.apis.guru<dt class="text-semibold mt-2">IP address:<dd class=wb-break-all>213.187.82.137</dl><footer class="mt-4 d-flex flex-justify-center flex-items-center flex-wrap text-small color-fg-muted"><img src=https://github.github.com/pages-staticassets/lock.svg width=16 height=16 class=flex-shrink-0> <span class=ml-2>Protected by&nbsp;<a href=https://pages.github.com/ class=Link target=_blank>GitHub Pages</a></span></footer></div></div></body></html>
swagger: "2.0"
schemes:
- https
host: test.api.amadeus.com
basePath: /v2
info:
description: |-

Before using this API, we recommend you read our **[Authorization Guide](https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262)** for more information on how to generate an access token.

Please also be aware that our test environment is based on a subset of the production, to see what is included in test please refer to our **[data collection](https://github.com/amadeus4dev/data-collection)**.
title: Flight Check-in Links
version: 2.1.2
x-logo:
url: https://api.apis.guru/v2/cache/logo/https_amadeus.com_images_en_technology_mobile-tablet_mobile-woman-office-city.jpg.transform_medium_img.jpg
x-origin:
- format: swagger
url: https://raw.githubusercontent.com/amadeus4dev/amadeus-open-api-specification/main/spec/json/FlightCheck-inLinks_v2_swagger_specification.json
version: "2.0"
x-providerName: amadeus.com
x-release-note:
"2.0":
- Initial Version
2.1.0:
- Change parameter "airline" by "airlineCode"
- Correct example
x-serviceName: amadeus-flight-check-in-links
x-status: validated
x-tags:
- "#ama-for-dev"
consumes:
- application/vnd.amadeus+json
produces:
- application/vnd.amadeus+json
responses:
"400":
description: |
code | title
------- | -------------------------------------
477 | INVALID FORMAT
572 | INVALID OPTION
32171 | MANDATORY DATA MISSING
schema:
$ref: "#/definitions/Error_400"
"500":
description: Unexpected Error
schema:
$ref: "#/definitions/Error_500"
checkin-links:
description: Successful Operation
schema:
example:
data:
- channel: All
href: https://www.britishairways.com/travel/managebooking/public/en_ch?&bookingRef={PNR}&lastname={LAST}
id: BAEN-GBAll
parameters:
LAST:
description: Passenger Last Name
type: string
PNR:
description: Record Locator
format: ([a-zA-Z]|[0-9]){6}
type: string
type: checkin-link
meta:
count: 1
links:
self: http://test.api.amadeus.com/v2/reference-data/urls/checkin-links?airlineCode=BA
warnings:
- code: 10151
detail: Language not available for this airline, default language applied
source:
parameter: language
status: 200
title: DEFAULT LANGUAGE USED
properties:
data:
items:
$ref: "#/definitions/CheckinLink"
type: array
meta:
$ref: "#/definitions/Collection_Meta"
warnings:
items:
$ref: "#/definitions/Issue"
type: array
required:
- data
title: Success
paths:
/reference-data/urls/checkin-links:
get:
description: ""
operationId: getCheckinURLs
parameters:
- description: |
Airline code following IATA or ICAO standard - e.g. 1X; AF or ESY

[IATA table codes](http://www.iata.org/publications/Pages/code-search.aspx)

[ICAO airlines table codes](https://en.wikipedia.org/wiki/List_of_airline_codes)
in: query
name: airlineCode
pattern: ([A-Z]{3}|[A-Z]{2})|([0-9][A-Z])|([A-Z][0-9])
required: true
type: string
x-example: BA
- description: |
Check-in page language with one of the following patterns 'languageCode' (e.g. EN) or 'languageCode-IATAcountryCode' (e.g. en-GB).

Default value is **en-GB** (used when required language is not available or when no value is specified).
in: query
name: language
pattern: "[a-zA-Z]{2}([-][a-zA-Z]{2})?"
required: false
type: string
responses:
"200":
$ref: "#/responses/checkin-links"
"400":
$ref: "#/responses/400"
default:
$ref: "#/responses/500"
summary: Lists Check-in URLs.
tags:
- checkin-links
definitions:
CheckinLink:
properties:
channel:
description: indicates the type of channel supported by the URL
enum:
- Mobile
- Web
- All
example: Mobile
type: string
href:
description: direct URL to the relevant page
format: uri
type: string
id:
description: identifier of the resource
example: 1XEN-GBMobile
type: string
parameters:
additionalProperties:
$ref: "#/definitions/Parameter"
description: list of URL parameters with descriptive information such as description and/or type and/or format
type:
description: the resource name
example: checkin-link
type: string
required:
- type
- id
- href
- channel
Collection_Meta:
properties:
count:
example: 1
type: integer
links:
example:
self: https://test.api.amadeus.com/v1/area/resources?param=value
properties:
first:
example: https://test.api.amadeus.com/v1/area/resources?...
format: uri
type: string
last:
example: https://test.api.amadeus.com/v1/area/resources?...
format: uri
type: string
next:
example: https://test.api.amadeus.com/v1/area/resources?...
format: uri
type: string
previous:
example: https://test.api.amadeus.com/v1/area/resources?...
format: uri
type: string
self:
example: https://test.api.amadeus.com/v1/area/resources?...
format: uri
type: string
up:
example: https://test.api.amadeus.com/v1/area/resources?...
format: uri
type: string
title: CollectionLinks
title: Collection_Meta
Error_400:
example:
errors:
- code: 477
detail: invalid query parameter format
source:
example: CDG
parameter: airport
status: 400
title: INVALID FORMAT
properties:
errors:
items:
$ref: "#/definitions/Issue"
type: array
required:
- errors
Error_500:
example:
errors:
- code: 141
status: 500
title: SYSTEM ERROR HAS OCCURRED
properties:
errors:
items:
$ref: "#/definitions/Issue"
type: array
required:
- errors
Issue:
properties:
code:
description: an application-specific error code
format: int64
type: integer
detail:
description: explanation of the error
type: string
source:
description: an object containing references to the source of the error
maxProperties: 1
properties:
example:
description: a string indicating an example of the right value
type: string
parameter:
description: a string indicating which URI query parameter caused the issue
type: string
pointer:
description: a JSON Pointer [RFC6901] to the associated entity in the request document
type: string
title: Issue_Source
type: object
status:
description: the HTTP status code applicable to this error
type: integer
title:
description: a short summary of the error
type: string
Parameter:
properties:
description:
description: parameter descriptive information
example: Passenger last name
type: string
format:
description: format of the parameter
example: ([a-zA-Z]|[0-9]){6}
type: string
type:
description: type of the parameter
example: string
type: string
required:
- type
x-generatedAt: 2020-07-23T11:25:45.773Z
Loading