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

fix: Remove optional params as null in docs #229

Merged
merged 1 commit into from
Nov 18, 2024
Merged

Conversation

ksentak
Copy link
Contributor

@ksentak ksentak commented Nov 6, 2024

When generating documentation from the OpenRPC, some methods have optional fields in either the request or response. These fields don't have to be present AT ALL if not needed.

Due to how the tooling is interpreting the schema vs the examples, documentation is being generated that infers that you must pass or receive these fields with "null" as the value instead of having the option to omit them entirely.

This PR fixes the documentation so that null is not passed as the value of an optional parameter that is not used in the examples section for a method.

// Example of what documentation currently looks 
let advertisingId = await Advertising.advertisingId(null)

// What documentation will now look like
let advertisingId = await Advertising.advertisingId()

If a method has multiple optional parameters and there is an example that sets the second optional parameter, undefined will be used as the first parameter.

method(undefined, 'value')

@ksentak ksentak requested a review from kschrief November 15, 2024 13:34
@kschrief kschrief merged commit 95808ef into next Nov 18, 2024
6 checks passed
@kschrief kschrief deleted the fix/null-params-in-docs branch November 18, 2024 15:58
kschrief pushed a commit that referenced this pull request Nov 18, 2024
# [3.2.0-next.9](v3.2.0-next.8...v3.2.0-next.9) (2024-11-18)

### Bug Fixes

* Remove optional params as null in documentation ([#229](#229)) ([95808ef](95808ef))
@kschrief
Copy link
Contributor

🎉 This PR is included in version 3.2.0-next.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants