Skip to content

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 📦🚀

kschrief pushed a commit that referenced this pull request Feb 28, 2025
# [3.2.0](v3.1.3...v3.2.0) (2025-02-28)

### Bug Fixes

* Add open-rpc to generated C++ SDK ([#217](#217)) ([a02980a](a02980a))
* C++ Auto-Reconnect ([#237](#237)) ([dde6753](dde6753))
* C++ Auto-Reconnect typo ([#240](#240)) ([bbd5813](bbd5813))
* C++ Pascal casing method name ([#233](#233)) ([ed1106f](ed1106f))
* Do not hard-code SDK Version in CI processes ([#228](#228)) ([45b513e](45b513e))
* Documentation generation enhancements ([#227](#227)) ([7fe212b](7fe212b))
* Events - Change promise all to reduce for sequential resolving ([#230](#230)) ([43f3ad3](43f3ad3))
* For C++ Capabilities.info ([#224](#224)) ([c21e49a](c21e49a))
* Generate full SDKs in CI for tooling changes ([#226](#226)) ([953f533](953f533))
* Make nested objects show in typescript .d.ts file and in the doc… ([#231](#231)) ([31217ce](31217ce))
* Native SDK unit tests support framework ([#223](#223)) ([819cc21](819cc21))
* Remove optional params as null in documentation ([#229](#229)) ([95808ef](95808ef))

### Features

* Cpp global subscriber type ([#218](#218)) ([45cbf0a](45cbf0a))
* Make private method and private events more hidden ([#216](#216)) ([d3d5bdd](d3d5bdd))
@kschrief
Copy link
Contributor

🎉 This PR is included in version 3.2.0 🎉

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.

3 participants