File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -921,7 +921,11 @@ const createResponse = (
921921 )
922922 }
923923
924- const actionAttemptType = parsedOperation [ 'x-action-attempt-type' ]
924+ const actionAttemptType = validateActionAttemptType (
925+ parsedOperation [ 'x-action-attempt-type' ] ,
926+ responseKey ,
927+ path ,
928+ )
925929 const refKey = responseKey
926930
927931 if ( refKey != null && properties [ refKey ] != null ) {
@@ -944,6 +948,25 @@ const createResponse = (
944948 }
945949}
946950
951+ const validateActionAttemptType = (
952+ actionAttemptType : string | undefined ,
953+ responseKey : string ,
954+ path : string ,
955+ ) => {
956+ const excludedPaths = [ '/action_attempts' ]
957+ const isPathExcluded = excludedPaths . some ( ( p ) => path . startsWith ( p ) )
958+
959+ if (
960+ actionAttemptType == null &&
961+ responseKey === 'action_attempt' &&
962+ ! isPathExcluded
963+ ) {
964+ throw new Error ( `Missing action_attempt_type for path ${ path } ` )
965+ }
966+
967+ return actionAttemptType
968+ }
969+
947970export const createProperties = (
948971 properties : Record < string , OpenapiSchema > ,
949972 parentPaths : string [ ] ,
You can’t perform that action at this time.
0 commit comments