Skip to content

Commit

Permalink
handle null variableToType objects
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed Dec 8, 2023
1 parent 22c1423 commit 4c069ee
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ export const graphqlInputTypeToJsonSchemaType = (
* Converts a VariableToType object to a JSON Schema object.
* This is used to generate a JSON Schema for the variables editor.
*/
export const vttToJsonSchema = (vtt: VariableToType): JSONSchema7 => {
export const vttToJsonSchema = (vtt?: VariableToType): JSONSchema7 => {
if (!vtt) {
return {
type: 'object',
properties: {},
};
}
return {
type: 'object',
properties: Object.entries(vtt).reduce((acc, [key, type]) => {
Expand Down

0 comments on commit 4c069ee

Please sign in to comment.