11<?php
22
33use cebe \openapi \Reader ;
4+ use cebe \openapi \spec \Example ;
45use cebe \openapi \spec \OpenApi ;
56use cebe \openapi \spec \Parameter ;
67use cebe \openapi \spec \Reference ;
78use cebe \openapi \spec \RequestBody ;
89use cebe \openapi \spec \Response ;
910use cebe \openapi \spec \Schema ;
10- use cebe \openapi \spec \Example ;
1111
1212/**
1313 * @covers \cebe\openapi\spec\Reference
@@ -441,21 +441,23 @@ public function testTransitiveReferenceOverTwoFiles()
441441 $ yaml = \cebe \openapi \Writer::writeToYaml ($ openapi );
442442
443443 $ expected = <<<YAML
444+ ---
444445openapi: 3.0.0
445446info:
446- title: ' Ref Example'
447+ title: Ref Example
447448 version: 1.0.0
448449paths:
449450 /pet:
450451 get:
451452 responses:
452- ' 200' :
453- description: ' return a pet'
453+ 200:
454+ description: return a pet
454455 /cat:
455456 get:
456457 responses:
457- '200':
458- description: 'return a cat'
458+ 200:
459+ description: return a cat
460+ ...
459461
460462YAML ;
461463 // remove line endings to make string equal on windows
@@ -474,53 +476,53 @@ public function testReferencedCommonParamsInReferencedPath()
474476 $ openapi = Reader::readFromYamlFile (__DIR__ . '/data/reference/ReferencedCommonParamsInReferencedPath.yml ' , OpenApi::class, \cebe \openapi \ReferenceContext::RESOLVE_MODE_INLINE );
475477 $ yaml = \cebe \openapi \Writer::writeToYaml ($ openapi );
476478 $ expected = <<<YAML
479+ ---
477480openapi: 3.0.0
478481info:
479- title: ' Nested reference with common path params'
482+ title: Nested reference with common path params
480483 version: 1.0.0
481484paths:
482485 /example:
483486 get:
484487 responses:
485- ' 200' :
486- description: ' OK if common params can be references'
488+ 200:
489+ description: OK if common params can be references
487490 request:
488491 content:
489492 application/json:
490493 examples:
491494 user:
492- summary: ' User Example'
495+ summary: User Example
493496 externalValue: ./paths/examples/user-example.json
494497 userex:
495- summary: ' External User Example'
496- externalValue: ' https://api.example.com/examples/user-example.json'
498+ summary: External User Example
499+ externalValue: https://api.example.com/examples/user-example.json
497500 parameters:
498- -
499- name: test
500- in: header
501- description: 'Test parameter to be referenced'
502- required: true
503- schema:
504- enum:
505- - test
506- type: string
501+ - name: test
502+ in: header
503+ description: Test parameter to be referenced
504+ required: true
505+ schema:
506+ enum:
507+ - test
508+ type: string
507509 x-something: something
508510 /something:
509511 get:
510512 responses:
511- ' 200' :
512- description: ' OK if common params can be references'
513+ 200:
514+ description: OK if common params can be references
513515 parameters:
514- -
515- name: test
516- in: header
517- description: 'Test parameter to be referenced'
518- required: true
519- schema:
520- enum:
521- - test
522- type: string
516+ - name: test
517+ in: header
518+ description: Test parameter to be referenced
519+ required: true
520+ schema:
521+ enum:
522+ - test
523+ type: string
523524 x-something: something
525+ ...
524526
525527YAML ;
526528 // remove line endings to make string equal on windows
@@ -541,16 +543,17 @@ public function testResolveRelativePathInline()
541543 $ yaml = \cebe \openapi \Writer::writeToYaml ($ openapi );
542544
543545 $ expected = <<<YAML
546+ ---
544547openapi: 3.0.3
545548info:
546- title: ' Link Example'
549+ title: Link Example
547550 version: 1.0.0
548551paths:
549552 /pet:
550553 get:
551554 responses:
552- ' 200' :
553- description: ' return a pet'
555+ 200:
556+ description: return a pet
554557components:
555558 schemas:
556559 Pet:
@@ -561,7 +564,7 @@ public function testResolveRelativePathInline()
561564 format: int64
562565 cat:
563566 \$ref: '#/components/schemas/Cat'
564- description: ' A Pet'
567+ description: A Pet
565568 Cat:
566569 type: object
567570 properties:
@@ -570,10 +573,11 @@ public function testResolveRelativePathInline()
570573 format: int64
571574 name:
572575 type: string
573- description: ' the cats name'
576+ description: the cats name
574577 pet:
575578 \$ref: '#/components/schemas/Pet'
576- description: 'A Cat'
579+ description: A Cat
580+ ...
577581
578582YAML ;
579583 // remove line endings to make string equal on windows
@@ -594,16 +598,17 @@ public function testResolveRelativePathAll()
594598 $ yaml = \cebe \openapi \Writer::writeToYaml ($ openapi );
595599
596600 $ expected = <<<YAML
601+ ---
597602openapi: 3.0.3
598603info:
599- title: ' Link Example'
604+ title: Link Example
600605 version: 1.0.0
601606paths:
602607 /pet:
603608 get:
604609 responses:
605- ' 200' :
606- description: ' return a pet'
610+ 200:
611+ description: return a pet
607612components:
608613 schemas:
609614 Pet:
@@ -620,11 +625,11 @@ public function testResolveRelativePathAll()
620625 format: int64
621626 name:
622627 type: string
623- description: ' the cats name'
628+ description: the cats name
624629 pet:
625630 \$ref: '#/components/schemas/Pet'
626- description: ' A Cat'
627- description: ' A Pet'
631+ description: A Cat
632+ description: A Pet
628633 Cat:
629634 type: object
630635 properties:
@@ -633,7 +638,7 @@ public function testResolveRelativePathAll()
633638 format: int64
634639 name:
635640 type: string
636- description: ' the cats name'
641+ description: the cats name
637642 pet:
638643 type: object
639644 properties:
@@ -642,8 +647,9 @@ public function testResolveRelativePathAll()
642647 format: int64
643648 cat:
644649 \$ref: '#/components/schemas/Cat'
645- description: 'A Pet'
646- description: 'A Cat'
650+ description: A Pet
651+ description: A Cat
652+ ...
647653
648654YAML ;
649655 // remove line endings to make string equal on windows
0 commit comments