You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "bzp2010 (via GitHub)" <gi...@apache.org> on 2024/06/02 07:00:22 UTC
[PR] feat: move tinyyaml to lyaml [apisix]
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: move tinyyaml to lyaml [apisix]
Posted by "bzp2010 (via GitHub)" <gi...@apache.org>.
bzp2010 commented on PR #11312:
URL: https://github.com/apache/apisix/pull/11312#issuecomment-2144348513
> This design was imported by https://github.com/apache/apisix/issues/9600, looking forword a better one.
Yes, the current design is not good but it is still work, so it will not be modified in this PR.
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: move tinyyaml to lyaml [apisix]
Posted by "bzp2010 (via GitHub)" <gi...@apache.org>.
bzp2010 commented on PR #11312:
URL: https://github.com/apache/apisix/pull/11312#issuecomment-2144329949
Reply to @moonming
> Do we need to change it to `http, stream`?
This should be controlled by some boolean value, e.g.
```
proxy_mode:
http: true
stream: true
```
It should even be further integrated with port settings, e.g.
```
listen:
- port: 443
http: true
- port: 5432
stream: true
```
These bad designs will be corrected by me (maybe), but not in this PR. there are many things just waiting to be revolutionized.
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: move tinyyaml to lyaml [apisix]
Posted by "bzp2010 (via GitHub)" <gi...@apache.org>.
bzp2010 commented on PR #11312:
URL: https://github.com/apache/apisix/pull/11312#issuecomment-2144219973
Please wait for some more REVIEWERS and don't merge for now.
> 请再等待一些reviewer,暂时不要合并。
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: move tinyyaml to lyaml [apisix]
Posted by "moonming (via GitHub)" <gi...@apache.org>.
moonming commented on PR #11312:
URL: https://github.com/apache/apisix/pull/11312#issuecomment-2144342623
> Reply to @moonming
>
> > Do we need to change it to `http, stream`?
>
> This should be controlled by some boolean value, e.g.
>
> ```
> proxy_mode:
> http: true
> stream: true
> ```
>
> It should even be further integrated with port settings, e.g.
>
> ```
> listen:
> - port: 443
> http: true
> - port: 5432
> stream: true
> ```
>
> These bad designs will be corrected by me (maybe), but not in this PR. there are many things just waiting to be revolutionized.
This design was imported by https://github.com/apache/apisix/issues/9600, looking forword a better one.
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: move tinyyaml to lyaml [apisix]
Posted by "bzp2010 (via GitHub)" <gi...@apache.org>.
bzp2010 commented on PR #11312:
URL: https://github.com/apache/apisix/pull/11312#issuecomment-2144290537
Regarding the changes in config-default.yaml:
- `1:2` will be parsed as number 62 instead of "1:2" in string
- `http&stream` contains the start character `&` of the YAML anchor syntax, which causes parsing errors
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: move tinyyaml to lyaml [apisix]
Posted by "bzp2010 (via GitHub)" <gi...@apache.org>.
bzp2010 commented on PR #11312:
URL: https://github.com/apache/apisix/pull/11312#issuecomment-2144334748
Reply to @Revolyssup
It could probably be deleted, but I don't want it here. Because I also want to make some changes to where the YAML is generated.
The reason: overwriting the old config.yaml file with the regenerated YAML does not preserve user comments, which may break some user efforts.
So I think it's better to generate it at runtime and use logging output or output to file like `conf/.random_admin_key`
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: move tinyyaml to lyaml [apisix]
Posted by "moonming (via GitHub)" <gi...@apache.org>.
moonming commented on PR #11312:
URL: https://github.com/apache/apisix/pull/11312#issuecomment-2144321750
> * `http&stream` contains the start character `&` of the YAML anchor syntax, which causes parsing errors
Do we need to change it to `http, stream`?
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: move tinyyaml to lyaml [apisix]
Posted by "bzp2010 (via GitHub)" <gi...@apache.org>.
bzp2010 merged PR #11312:
URL: https://github.com/apache/apisix/pull/11312
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org