Repository navigation
Is there a way to swap unevaluatedProperties to additionalProperties? #9514
Replies: 1 comment
|
As far as I can tell from the emitter source, there's no switch for this today. In The workaround I'd use is import "@typespec/json-schema";
using JsonSchema;
@jsonSchema
@extension("additionalProperties", #{ not: #{} }) // or `false`
model FunctionTool is BaseTool {
function: FunctionDef;
}Keep in mind that |
Uh oh!
There was an error while loading. Please reload this page.
I'm familiar with the reason TypeSpec decided to use
unevaluatedPropertiesinstead ofadditionalProperties, which is outlined here: #3549However, I wonder if there are cases where a model is inheriting another model's properties inline via
iswhereunevaluatedPropertiesactively hurts the error messaging and IDE validation experience.Refer to the two pictures below. One schema uses
additionalPropertieseverywhere while the other usesunevaluatedProperties.Context: The model requires a
functionproperty to be set. The pictures below show the difference in error messaging when using tools like Monaco editor (VS Code) and CodeMirror:unevaluatedProperties
additionalProperties
It would be nice to have the ability within TypeSpec to control this. Is there any solution today to handle this?
All reactions