Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed syntax errors in api-with-examples.yaml #2036

Closed
wants to merge 1 commit into from
Closed

Fixed syntax errors in api-with-examples.yaml #2036

wants to merge 1 commit into from

Conversation

mabar
Copy link

@mabar mabar commented Oct 21, 2019

With original, php implementation of yaml symfony/yaml I got some syntax errors. This PR fixes them.

Online parsers which consider current file valid:

Online parsers which reports error:

With proposed changes is file valid for all of them

@cebe
Copy link
Contributor

cebe commented Dec 6, 2019

Seems inline YAML spanning multiple lines was not officially supported in symfony/yaml until version 4.4: symfony/symfony#34805 (comment) (there is also a bug with parsing these in the current version, which is reported in the linked issue)

cebe pushed a commit to cebe/OpenAPI-Specification that referenced this pull request Dec 6, 2019
@mabar
Copy link
Author

mabar commented Jan 5, 2020

Tried latest version of files with symfony/yaml 4.4 and 5.0 and api-with-examples.yaml now work. But upsto.yaml stopped working. Symfony bug, I guess, I don't see any problems in current syntax

   Symfony\Component\Yaml\Exception\ParseException: Malformed inline YAML string: {
       "total": 2,
       "apis": [
       {
           "apiKey": "oa_citations",
           "apiVersionNumber": "v1",
           "apiUrl": "https://developer.uspto.gov/ds-api/oa_citations/v1/fields",
           "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/oa_citations.json"
       },
       {
           "apiKey": "cancer_moonshot",
           "apiVersionNumber": "v1",
           "apiUrl": "https://developer.uspto.gov/ds-api/cancer_moonshot/v1/fields",
           "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/cancer_moonshot.json"
       }
       ]
   } at line 64 (near "}").

   in symfony/yaml/Inline.php(300)
   in symfony/yaml/Inline.php(375) Symfony\Component\Yaml\Inline::parseScalar()
   in symfony/yaml/Inline.php(473) Symfony\Component\Yaml\Inline::parseSequence()
   in symfony/yaml/Inline.php(85) Symfony\Component\Yaml\Inline::parseMapping()
   in symfony/yaml/Parser.php(366) Symfony\Component\Yaml\Inline::parse()
   in symfony/yaml/Parser.php(516) Symfony\Component\Yaml\Parser->doParse()
   in symfony/yaml/Parser.php(312) Symfony\Component\Yaml\Parser->parseBlock()
   in symfony/yaml/Parser.php(516) Symfony\Component\Yaml\Parser->doParse()
   in symfony/yaml/Parser.php(312) Symfony\Component\Yaml\Parser->parseBlock()
   in symfony/yaml/Parser.php(516) Symfony\Component\Yaml\Parser->doParse()
   in symfony/yaml/Parser.php(312) Symfony\Component\Yaml\Parser->parseBlock()
   in symfony/yaml/Parser.php(516) Symfony\Component\Yaml\Parser->doParse()
   in symfony/yaml/Parser.php(312) Symfony\Component\Yaml\Parser->parseBlock()
   in symfony/yaml/Parser.php(516) Symfony\Component\Yaml\Parser->doParse()
   in symfony/yaml/Parser.php(312) Symfony\Component\Yaml\Parser->parseBlock()
   in symfony/yaml/Parser.php(516) Symfony\Component\Yaml\Parser->doParse()
   in symfony/yaml/Parser.php(312) Symfony\Component\Yaml\Parser->parseBlock()
   in symfony/yaml/Parser.php(516) Symfony\Component\Yaml\Parser->doParse()
   in symfony/yaml/Parser.php(312) Symfony\Component\Yaml\Parser->parseBlock()
   in symfony/yaml/Parser.php(516) Symfony\Component\Yaml\Parser->doParse()
   in symfony/yaml/Parser.php(312) Symfony\Component\Yaml\Parser->parseBlock()
   in symfony/yaml/Parser.php(95) Symfony\Component\Yaml\Parser->doParse()
   in symfony/yaml/Parser.php(63) Symfony\Component\Yaml\Parser->parse()
   in symfony/yaml/Yaml.php(57) Symfony\Component\Yaml\Parser->parseFile()
   in cases/Schema/ExamplesTest.phpt(65) Symfony\Component\Yaml\Yaml::parseFile()

@MikeRalphson
Copy link
Member

@cebe @mabar Can we not use a YAML library which supports the whole of the 1.2 spec and uses the official YAML test suite? If that means ditching PHP from the proposed GitHub actions, then so be it, and here's a vote to use Javascript instead as per the existing (and a couple of proposed) Travis CI jobs.

@cebe
Copy link
Contributor

cebe commented Jan 8, 2020

Can we not use a YAML library which supports the whole of the 1.2 spec and uses the official YAML test suite? If that means ditching PHP from the proposed GitHub actions, then so be it.

As far as I see there is no PHP library that matches the criteria. Most stable and supported library is the one we are using right now.

However the version I am using in the github action works well with our current set of example YAML files. The issue shown above in upsto.yaml is a bug that exists in symfony >=4.4.

I suggest to keep the current implementation now (as it is working) and replace it with a javascript implementation when someone has time to work on that.

@darrelmiller
Copy link
Member

Closing as this is a duplicate of #1914

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants