@@ -89,7 +89,40 @@ private function assertApiContent(\cebe\openapi\spec\OpenApi $openapi)
8989 $ this ->assertEquals ("1.0.0 " , $ openapi ->info ->version );
9090 }
9191
92-
92+ /**
93+ * @see https://github.com/symfony/symfony/issues/34805
94+ */
95+ public function testSymfonyYamlBugHunt ()
96+ {
97+ $ openApiFile = __DIR__ . '/../vendor/oai/openapi-specification/examples/v3.0/uspto.yaml ' ;
98+ $ openapi = \cebe \openapi \Reader::readFromYamlFile ($ openApiFile );
99+
100+ $ inlineYamlExample = $ openapi ->paths ['/ ' ]->get ->responses ['200 ' ]->content ['application/json ' ]->example ;
101+ $ this ->assertInternalType ('array ' , $ inlineYamlExample );
102+ $ expectedArray = json_decode (<<<JSON
103+ {
104+ "total": 2,
105+ "apis": [
106+ {
107+ "apiKey": "oa_citations",
108+ "apiVersionNumber": "v1",
109+ "apiUrl": "https://developer.uspto.gov/ds-api/oa_citations/v1/fields",
110+ "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/oa_citations.json"
111+ },
112+ {
113+ "apiKey": "cancer_moonshot",
114+ "apiVersionNumber": "v1",
115+ "apiUrl": "https://developer.uspto.gov/ds-api/cancer_moonshot/v1/fields",
116+ "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/cancer_moonshot.json"
117+ }
118+ ]
119+ }
120+ JSON
121+ , true );
122+ $ this ->assertEquals ($ expectedArray , $ inlineYamlExample );
123+ }
124+
125+
93126 // TODO test invalid JSON
94127 // TODO test invalid YAML
95128}
0 commit comments