bzp2010 opened a new pull request, #11312:
URL: https://github.com/apache/apisix/pull/11312

   ### Description
   
   APISIX now uses a YAML parser called `tinyyaml`, which has a number of 
problems, such as:
   
   - accept use cases that do not conform to the YAML specification
   ```yaml
   routes:
       -       # Such indentation is obviously wrong, but certain developers 
think it is acceptable. Unbelievable!
       id: 1
       uri: "/test"
   ```
   ```yaml
   such-key:
       - id: second
         service:
           schema: "http",    # This is also obviously wrong; YAML does not 
need to use "," as a end character.
           host: "127.0.0.1", # This is not "optional", the standard parser 
does not accept this error at all.
   ```
   - No support for the new YAML standard (e.g. anchors syntax)
   
   ```yaml
   upstream:
     - &u
       nodes: xxx
       type: roundrobin
   
   routes:
     - id: 1
       upstream: *u
     - id: 2
       upstream: *u
   ```
   
   There have been many issues logged for tinyyaml. 
https://github.com/apache/apisix/issues?q=tinyyaml
   
   This PR therefore introduces a change to replace tinyyaml with a wrapper for 
the libyaml C library, which is the C reference implementation of the YAML 
project. It is more standardized and advanced.
   
   ------
   
   Theoretically, if the user is using a fully YAML-compliant document, the 
change is insensitive. Otherwise it will report an error.
   
   So I think it's largely backward compatible. But as stated in the background 
above, in the past our developers created so many buggy test cases that they 
had to be fixed one by one. The good thing is that they have been fixed 
completely and without substantially changing the testing process.
   
   The outliers in config-default.yaml have also been fixed.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to