Skip to content
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

Inaccurate type definitions in ask-sdk-model #728

Open
vmwxiong opened this issue Jan 27, 2023 · 0 comments
Open

Inaccurate type definitions in ask-sdk-model #728

vmwxiong opened this issue Jan 27, 2023 · 0 comments

Comments

@vmwxiong
Copy link

vmwxiong commented Jan 27, 2023

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

This is the declaration for IntentRequest, notably the dialogState property is declared as non-optional, though the comment above it seems to imply that it shouldn’t always exist.

/**
 * An IntentRequest is an object that represents a request made to a skill based on what the user wants to do.
 * @interface
 */
export interface IntentRequest {
    'type': 'IntentRequest';
    /**
     * Represents the unique identifier for the specific request.
     */
    'requestId': string;
    /**
     * Provides the date and time when Alexa sent the request as an ISO 8601 formatted string. Used to verify the request when hosting your skill as a web service.
     */
    'timestamp': string;
    /**
     * A string indicating the user's locale. For example: en-US. This value is only provided with certain request types.
     */
    'locale'?: string;
    /**
     * Enumeration indicating the status of the multi-turn dialog. This property is included if the skill meets the requirements to use the Dialog directives. Note that COMPLETED is only possible when you use the Dialog.Delegate directive. If you use intent confirmation, dialogState is considered COMPLETED if the user denies the entire intent (for instance, by answering "no" when asked the confirmation prompt). Be sure to also check the confirmationStatus property on the Intent object before fulfilling the user's request.
     */
    'dialogState': DialogState;
    /**
     * An object that represents what the user wants.
     */
    'intent': Intent;
}

The request body I have coming in from Alexa does not contain this property, so when setting up a test mock, I noticed that it was complaining that this property was missing

Additionally, it looks like if a resolution comes in as ER_SUCCESS_NO_MATCH, it does not contain a values property. This is the type definition for a resolution, indicating that a values property is always required:

export declare namespace slu.entityresolution {
    /**
     * Represents a possible authority for entity resolution
     * @interface
     */
    interface Resolution {
        'authority': string;
        'status': slu.entityresolution.Status;
        'values': Array<slu.entityresolution.ValueWrapper>;
    }
}

This is an example of the JSON received in a request's request.intent. You can see that it is missing the dialogState property, and the values property when the resolution is ER_SUCCESS_NO_MATCH:

   {
      name: "ArtistTitleIntent",
      confirmationStatus: "NONE",
      slots: {
        ARTIST_B: {
          name: "ARTIST_B",
          confirmationStatus: "NONE"
        },
        TRACK_TITLE: {
          name: "TRACK_TITLE",
          value: "what's my name",
          resolutions: {
            resolutionsPerAuthority: [
              {
                authority:
                  "[removed for privacy]",
                status: {
                  code: "ER_SUCCESS_MATCH"
                },
                values: [
                  {
                    value: {
                      name: "who am i, what's my name",
                      id: "[removed for privacy]"
                    }
                  },
                  {
                    value: {
                      name: "that's not my name",
                      id: "[removed for privacy]"
                    }
                  },
                  {
                    value: {
                      name: "what's your name",
                      id: "[removed for privacy]"
                    }
                  },
                  {
                    value: {
                      name: "what's your name what's your number",
                      id: "[removed for privacy]"
                    }
                  },
                  {
                    value: {
                      name: "this is what you came for",
                      id: "[removed for privacy]"
                    }
                  }
                ]
              },
              {
                authority:
                  "[removed for privacy]",
                status: {
                  code: "ER_SUCCESS_MATCH"
                },
                values: [
                  {
                    value: {
                      name: "What's My Name",
                      id: "[removed for privacy]"
                    }
                  }
                ]
              }
            ]
          },
          confirmationStatus: "NONE",
          source: "USER",
          slotValue: {
            type: "Simple",
            value: "what's my name",
            resolutions: {
              resolutionsPerAuthority: [
                {
                  authority:
                    "[removed for privacy]",
                  status: {
                    code: "ER_SUCCESS_MATCH"
                  },
                  values: [
                    {
                      value: {
                        name: "who am i, what's my name",
                        id: "[removed for privacy]"
                      }
                    },
                    {
                      value: {
                        name: "that's not my name",
                        id: "[removed for privacy]"
                      }
                    },
                    {
                      value: {
                        name: "what's your name",
                        id: "[removed for privacy]"
                      }
                    },
                    {
                      value: {
                        name: "what's your name what's your number",
                        id: "[removed for privacy]"
                      }
                    },
                    {
                      value: {
                        name: "this is what you came for",
                        id: "[removed for privacy]"
                      }
                    }
                  ]
                },
                {
                  authority:
                    "[removed for privacy]",
                  status: {
                    code: "ER_SUCCESS_MATCH"
                  },
                  values: [
                    {
                      value: {
                        name: "What's My Name",
                        id: "[removed for privacy]"
                      }
                    }
                  ]
                }
              ]
            }
          }
        },
        ARTIST_A: {
          name: "ARTIST_A",
          value: "drake Rihanna",
          resolutions: {
            resolutionsPerAuthority: [
              {
                authority:
                  "[removed for privacy]",
                status: {
                  code: "ER_SUCCESS_NO_MATCH"
                }
              },
              {
                authority:
                  "[removed for privacy]",
                status: {
                  code: "ER_SUCCESS_NO_MATCH"
                }
              }
            ]
          },
          confirmationStatus: "NONE",
          source: "USER",
          slotValue: {
            type: "Simple",
            value: "drake Rihanna",
            resolutions: {
              resolutionsPerAuthority: [
                {
                  authority:
                    "[removed for privacy]",
                  status: {
                    code: "ER_SUCCESS_NO_MATCH"
                  }
                },
                {
                  authority:
                    "[removed for privacy]",
                  status: {
                    code: "ER_SUCCESS_NO_MATCH"
                  }
                }
              ]
            }
          }
        }
      }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant