-
Notifications
You must be signed in to change notification settings - Fork 0
feat: ComponentProperty / ComponentPropertyDefinition を type 別スキーマに分割 #46
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@plainbrew/figma-rest-api-spec": minor | ||
| --- | ||
|
|
||
| ComponentPropertyDefinition / ComponentProperty を type 別スキーマに分割 |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Figma REST API property types INSTANCE_SWAP preferredValues optional required💡 Result:
In the Figma REST API,
preferredValuesis only applicable toINSTANCE_SWAPcomponent properties, and it is optional (not required).ComponentPropertyDefinitiontype(BOOLEAN|INSTANCE_SWAP|TEXT|VARIANT)defaultValue(Boolean | String)variantOptions?(only exists forVARIANT)preferredValues?(only exists forINSTANCE_SWAP) [1]ComponentProperty(property values on an instance)typevaluepreferredValues?(only exists forINSTANCE_SWAP) [1]preferredValueselement shape:InstanceSwapPreferredValuetype:COMPONENTorCOMPONENT_SETkey: string (the component/component-set key) [1]So, for
INSTANCE_SWAP,preferredValuesmay be present, but clients should treat it as optional and handle it being absent. [1]Sources
🌐 Web query:
Figma API ComponentProperty boundVariables optional documentation💡 Result:
In Figma’s APIs,
boundVariablesis optional and only present/populated when something is actually bound to a Variable.ComponentPropertyDefinitionsnotes that a component property can optionally be bound to a Variable; when it is, theboundVariablesstructure is populated with aVariableAlias(otherwise it’s absent/empty). [1]boundVariablesmap that may include acomponentPropertiessub-map (by property name) when component properties are variable-bound; if nothing is bound, that map/field won’t be present. [2]boundVariablesis documented as a (custom) property type, reinforcing it as a node field that may appear depending on bindings. [3]Docs: [1] ComponentPropertyDefinitions (Plugin API), [2] REST API “Files” / global node properties, [3] REST API “File property types”.
🌐 Web query:
site:figma.com REST API property definitions ComponentProperty INSTANCE_SWAP💡 Result:
In the Figma REST API file JSON, component property definitions are represented as a map of
ComponentPropertyDefinitionobjects (typically exposed under a node’scomponentPropertyDefinitionsforCOMPONENT/COMPONENT_SETnodes).For an instance swap property, the definition shape is:
type:INSTANCE_SWAPdefaultValue:string(the initial value for instances; REST type isBoolean | String)preferredValues?: array ofInstanceSwapPreferredValue(only present forINSTANCE_SWAP)type:"COMPONENT"or"COMPONENT_SET"key: the component / component set keyThe relevant REST type definitions are documented under
ComponentPropertyDefinition,ComponentPropertyType, andInstanceSwapPreferredValue. [1]The same “definitions map” concept (and the note that
INSTANCE_SWAPdefinitions can includepreferredValues) is also described in Figma’sComponentPropertyDefinitionsreference. [2]Sources: [1] (developers.figma.com) [2] (developers.figma.com)
Citations:
Make
preferredValuesandboundVariablesoptional in schema, not required.According to official Figma REST API documentation,
preferredValuesforINSTANCE_SWAPis optional and only appears when defined. Similarly,boundVariablesis optional and only present when something is actually bound to a variable. The current schema incorrectly marks these as required, which breaks compatibility with the actual API behavior and will cause validation failures and client generation errors.Required schema changes
InstanceSwapComponentPropertyDefinition: ... required: - type - defaultValue - - preferredValues VariantComponentProperty: ... required: - type - value - - boundVariables InstanceSwapComponentProperty: ... required: - type - value - - preferredValuesApplies to lines 5566-5574, 5631-5641, 5653-5661.
🤖 Prompt for AI Agents