aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
89 stars 77 forks source link

Unable to create list of enum in schema #2350

Closed ayepRahman closed 7 months ago

ayepRahman commented 7 months ago

Environment information

System:
  OS: macOS 14.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 600.38 MB / 32.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
  Yarn: 1.22.21 - ~/.nvm/versions/node/v18.18.0/bin/yarn
  npm: 9.8.1 - ~/.nvm/versions/node/v18.18.0/bin/npm
  pnpm: 8.15.4 - ~/.nvm/versions/node/v18.18.0/bin/pnpm
NPM Packages:
  @aws-amplify/backend: 0.12.1
  @aws-amplify/backend-cli: 0.11.1
  aws-amplify: 6.0.20
  aws-cdk: 2.132.1
  aws-cdk-lib: 2.132.1
  typescript: 5.4.2
AWS environment variables:
  AWS_STS_REGIONAL_ENDPOINTS = regional
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables

Description

I'am unable to create an array of enums.

const adas = a.schema({
    Amenity: a.enum([
        "AIR_CONDITIONING",
        "BEACH_ACCESS",
        "BREAKFAST",
        "CAFE",
        "FIRE_EXTINGUISHER",
        "FREE_PARKING",
        "KITCHEN",
        "LAKE_ACCESS",
        "OUTDOOR_DINING_AREA",
        "OUTDOOR_FURNITURE",
        "OUTDOOR_KITCHEN",
    ]),
    Listing: a
        .model({
            amenities: a.ref("Amenity").array(), // 
                         ....
        })
        .authorization([
            a.allow.specificGroup("Admin"),
            a.allow.owner(),
            a.allow.public().to(["read"]),
        ]),
});
AnilMaktala commented 7 months ago

Hey @ayepRahman, Thanks for raising this. could please upgrade your backend lib to latest version and let us know if it resolves the issue.

chrisbonifacio commented 7 months ago

Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you.

Thank you!