You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like my schema to include markdownDescription attributes so that VS Code (via the JSON and YAML language servers) will render help text properly in hover overlays. Since I don't want to have to maintain duplicate versions of each description, I was hoping to use InterceptSchema to populate the markdownDescription value automatically.
Unfortunately, many of my descriptions are set via PrepareJSONSchema() (they're long and not conducive to being managed in struct tags). It appears that both the property and schema interceptors are called beforePrepareJSONSchema.
I expected schema to contain the markdownDescription prop set to the content of the description... sadly, it did not. I had to post-process schema with the following. Which honestly, wasn't that big of a deal. It was just confusing because it seemed like the interceptor approach was the right way to go about it.
I don't know if this is technically a bug, or if the behavior is by design. If it's the latter, I think it would be good to document in both interceptor functions to prevent further confusion.
The text was updated successfully, but these errors were encountered:
Thank you for raising this, I think this should be considered a bug.
Preparer is an attribute of schema (can be used in multiple reflections), while interceptor is an attribute of a reflection. I think it makes sense to trigger preparer before triggering processed interceptor.
However, there is another issue with your example. The problem is that you prepare parent schema, but interceptor is called for schemas as they are built from deeper nodes to outer.
start
walk properties
intercept schema of Something string (no description here yet, but schema is finished and set to parent)
prepare schema of MySchema (set property description)
intercept schema of MySchema
Let me think how such a (racy?) case can be solved conveniently.
Describe the bug
I would like my schema to include
markdownDescription
attributes so that VS Code (via the JSON and YAML language servers) will render help text properly in hover overlays. Since I don't want to have to maintain duplicate versions of each description, I was hoping to useInterceptSchema
to populate themarkdownDescription
value automatically.Unfortunately, many of my descriptions are set via
PrepareJSONSchema()
(they're long and not conducive to being managed in struct tags). It appears that both the property and schema interceptors are called beforePrepareJSONSchema
.To Reproduce
Expected behavior
I expected
schema
to contain themarkdownDescription
prop set to the content of thedescription
... sadly, it did not. I had to post-processschema
with the following. Which honestly, wasn't that big of a deal. It was just confusing because it seemed like the interceptor approach was the right way to go about it.Additional context
I don't know if this is technically a bug, or if the behavior is by design. If it's the latter, I think it would be good to document in both interceptor functions to prevent further confusion.
The text was updated successfully, but these errors were encountered: