fix: render server host without scheme for AsyncAPI v3#659
fix: render server host without scheme for AsyncAPI v3#659sahillllllllll-bit wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
| </Text> | ||
| ); | ||
| } | ||
| ServerInfo.propTypes = { |
There was a problem hiding this comment.
Reference in n
Hi @derberg,
Thanks for the quick review!
The ServerInfo.propTypes = { ... } part is PropTypes validation for the server prop passed to the ServerInfo component.
I added it because:
- SonarQube (the project's Quality Gate) flagged code on the new lines where I used
server.host()andserver.pathname() - It complained: "'server.host' is missing in props validation" and same for pathname
- Without PropTypes, the Maintainability Rating dropped below A on new code → Quality Gate failed
This minimal validation fixes those warnings so the PR passes SonarQube checks (now green after push).
If the project doesn't use/want PropTypes at all, we can remove it or suppress the rule — happy to adjust!
Let me know what you prefer.
There was a problem hiding this comment.
but only host and protocl are required
https://www.asyncapi.com/docs/reference/specification/v3.0.0#serverObject
and if they are required on spec level, this means you can be 100% sure template will get this data, otherwise generator will not run and fail on validation - so no need to protect from it
the only issue can be pathname - but your code already handles that part, checks if provided
id remove that
There was a problem hiding this comment.
Hi @derberg,
Thanks for the detailed explanation! Makes total sense — since host and protocol are required at spec level, no need for extra protection.
I removed the entire PropTypes block as you suggested.
PR updated now — only the host fix remains.
Thanks again,
|
|
This pull request has been automatically marked as stale because it has not had recent activity 😴 It will be closed in 120 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation. There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model. Let us figure out together how to push this pull request forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |




Description
This PR fixes incorrect server rendering in AsyncAPI v3 specifications where the server was displayed using the old v2-style
URLwith scheme prefix (kafka://.../) instead of the correct v3hostfield.Changes made:
server.url()withserver.host() + server.pathname()in theServerInfocomponentkafka://) and trailing slash when pathname is emptyBefore (old output):
URL:
kafka://kafka.example.com:9092/Protocol: kafka
After (new output):
Host:
kafka.example.com:9092Protocol: kafka
Related issue(s)
Fixes #658
Testing
Hostfield without scheme prefix.