Add "custom type" defintions for protocol.json/protocol.md generation#1324
Open
sid2934 wants to merge 1 commit intoobsproject:masterfrom
Open
Add "custom type" defintions for protocol.json/protocol.md generation#1324sid2934 wants to merge 1 commit intoobsproject:masterfrom
sid2934 wants to merge 1 commit intoobsproject:masterfrom
Conversation
Author
|
A quick note outside of the PR description. While the pattern that I submitted with the current commits would work for my needs, I am not sure the formatting or location of the custom type comments are where you all would like. My personal preferences would be to create the typed classes for the request/response property types, annotate those, and then use static types across the code base. That said that adds a degree of inflexibility that can be a challenge to keep up-to-date with changing models from the upstream project. I am more than happy to make adjustments or change approach as you all see fit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This Pull Request hopes to propose a solution to an issue I was facing. Currently the protocol.json/md do not provided full type information for generating clients that call the OBS WebSocket server. Internally obs-websocket is build responses dynamically for a number of request/response properties. This means its flexible, but at the cost of usability when the API is fairly stable at this point.
Motivation and Context
The motivation here is to introduce light weight mechanism that will allow generators to create fully statically typed models for the request/response objects. This is the less invasive of the two options I considered since it does not modify any of the obs-websocket code, as all of the changes are in comments and the documentation generators only.
The alternative option is create the needed request/response property type models (likely header files) and enforce the use of statically typed objects throughout the code base. These new models work require the same/similar annotation to produce the proper protocol.json.
How Has This Been Tested?
Generators are working, no core changes to obs-websocket functionality
Tested OS(s):
Windows and MacOS
Types of changes
Checklist:
masteror arelease/*branch.