Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
composer-deps: lowest
- php-version: "7.4"
composer-deps: latest
- php-version: "8.0"
composer-deps: lowest
- php-version: "8.0"
composer-deps: latest
- php-version: "8.1"
composer-deps: latest
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
Expand All @@ -48,10 +48,10 @@ jobs:
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.composer-deps }}"

- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest --ignore-platform-reqs"
run: "composer install --no-interaction --no-progress --ignore-platform-reqs"

- name: "Update dependencies (lowest)"
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest --prefer-stable"
run: "composer update --no-interaction --no-progress --prefer-lowest --prefer-stable"
if: ${{ matrix.composer-deps == 'lowest' }}

- name: "Update dependencies (latest)"
Expand Down
13 changes: 9 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
}
],
"require": {
"php": "^7.4 || ~8.0.0",
"cebe/php-openapi": "^1.5.2",
"symfony/console": "^v5.1.9"
"php": "^7.4 || ~8.0.0 || ~8.1.0",
"cebe/php-openapi": "^1.7.0",
"symfony/console": "^5.1.9 || ^6.0"
},
"require-dev": {
"doctrine/coding-standard": "^9.0.0",
Expand Down Expand Up @@ -59,7 +59,12 @@
"infection": "infection --threads=4 --coverage=build/coverage"
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"infection/extension-installer": true,
"ocramius/package-versions": true
}
},
"bin": [
"bin/openapi-merge"
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.4-cli-alpine
FROM php:8.0-cli-alpine

RUN php --version

Expand Down
100 changes: 9 additions & 91 deletions tests/Acceptance/ApplicationAcceptanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use function implode;
use function shell_exec;
use function sprintf;
use function version_compare;

use const PHP_VERSION;

/**
* @coversNothing
Expand All @@ -28,97 +31,12 @@ public function testApplicationRuns(): void
])
));

self::assertSame(
<<<'EXPECTED_YAML'
openapi: 3.0.2
info:
title: 'Example OpenAPI Definition'
description: 'This is the example Description'
contact:
name: 'Base Author'
url: base.example.org
email: base-file@example.org
license:
name: MIT
url: 'https://tldrlegal.com/license/mit-license'
version: '1.0'
servers:
-
url: 'https://api.base.example.org'
description: 'Main Base URL'
paths:
/ping:
get:
tags:
- 'Base Route'
summary: 'Your GET endpoint'
description: 'Description of Ping'
operationId: get-ping
parameters:
-
name: responseWith
in: query
description: 'response with this message'
schema:
maxLength: 20
minLength: 0
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
required:
- response
type: object
properties:
response:
type: string
'400':
description: 'Bad Request'
content:
application/problem+json:
schema:
title: ProblemResponse
required:
- type
- title
type: object
properties:
type:
type: string
description: 'type of the problem'
example: ValidationError
title:
type: string
example: 'Your request parameters didn''t validate.'
description: 'Default Problem Response'
post:
summary: 'Your POST endpoint'
description: 'Description of post Ping'
operationId: post-ping
responses:
'200':
description: OK
content:
application/json:
schema:
required:
- response
type: object
properties:
response:
type: string
components:
schemas: []
security: []
tags:
-
name: Base
self::assertNotNull($output);

EXPECTED_YAML,
$output
);
if (version_compare(PHP_VERSION, '8.1.0', '>=')) {
self::assertStringEqualsFile(__DIR__ . '/Fixtures/expected_php81.yml', $output);
} else {
self::assertStringEqualsFile(__DIR__ . '/Fixtures/expected_php80.yml', $output);
}
}
}
86 changes: 86 additions & 0 deletions tests/Acceptance/Fixtures/expected_php80.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
openapi: 3.0.2
info:
title: 'Example OpenAPI Definition'
description: 'This is the example Description'
contact:
name: 'Base Author'
url: base.example.org
email: base-file@example.org
license:
name: MIT
url: 'https://tldrlegal.com/license/mit-license'
version: '1.0'
servers:
-
url: 'https://api.base.example.org'
description: 'Main Base URL'
paths:
/ping:
get:
tags:
- 'Base Route'
summary: 'Your GET endpoint'
description: 'Description of Ping'
operationId: get-ping
parameters:
-
name: responseWith
in: query
description: 'response with this message'
schema:
maxLength: 20
minLength: 0
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
required:
- response
type: object
properties:
response:
type: string
'400':
description: 'Bad Request'
content:
application/problem+json:
schema:
title: ProblemResponse
required:
- type
- title
type: object
properties:
type:
type: string
description: 'type of the problem'
example: ValidationError
title:
type: string
example: 'Your request parameters didn''t validate.'
description: 'Default Problem Response'
post:
summary: 'Your POST endpoint'
description: 'Description of post Ping'
operationId: post-ping
responses:
'200':
description: OK
content:
application/json:
schema:
required:
- response
type: object
properties:
response:
type: string
components:
schemas: { }
security: []
tags:
-
name: Base
86 changes: 86 additions & 0 deletions tests/Acceptance/Fixtures/expected_php81.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
openapi: 3.0.2
info:
title: 'Example OpenAPI Definition'
description: 'This is the example Description'
contact:
name: 'Base Author'
url: base.example.org
email: base-file@example.org
license:
name: MIT
url: 'https://tldrlegal.com/license/mit-license'
version: '1.0'
servers:
-
url: 'https://api.base.example.org'
description: 'Main Base URL'
paths:
/ping:
get:
tags:
- 'Base Route'
summary: 'Your GET endpoint'
description: 'Description of Ping'
operationId: get-ping
parameters:
-
name: responseWith
in: query
description: 'response with this message'
schema:
maxLength: 20
minLength: 0
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
required:
- response
type: object
properties:
response:
type: string
'400':
description: 'Bad Request'
content:
application/problem+json:
schema:
title: ProblemResponse
required:
- type
- title
type: object
properties:
type:
type: string
description: 'type of the problem'
example: ValidationError
title:
type: string
example: "Your request parameters didn't validate."
description: 'Default Problem Response'
post:
summary: 'Your POST endpoint'
description: 'Description of post Ping'
operationId: post-ping
responses:
'200':
description: OK
content:
application/json:
schema:
required:
- response
type: object
properties:
response:
type: string
components:
schemas: { }
security: []
tags:
-
name: Base