Closed EricDunaway closed 1 year ago
Hi @EricDunaway Thanks for reporting this issue, I did some digging in Amplify platform libraries, that the ModelOperation
definition is consistent as enum ModelOperation { CREATE, UPDATE, DELETE, READ }
. It looks libraries don't support the finer control over the detailed read
operations.
Do you have any specific use case requires the finer control where using read
is insufficient?
@HuiSF I am trying to prevent the use of list operations from FE clients
The auth rule works as intended when querying the API in the console, but the generated code is causing build failures due to the missing values.
I suppose this could be considered a bug with the model generator, but since the generated code matches what I defined in the schema, I feel the library is incorrect.
OK thanks for the detail. I couldn't think of a reason why the finer read operation control is not supported in the library, I need to do some digging and get back to you.
Description
The documentation describes the
@auth
directive as supporting the following operationsDocs: Authorization rules
I get an error of
Error: Member not found: 'GET'.
when trying to build with models generated from a schema with a directive such as@auth(rules: [{allow: owner, operations: [get]}])
Looking at the source for the package the granular read operations are not available.
enum ModelOperation { CREATE, UPDATE, DELETE, READ }
(src: packages/amplify_core/lib/src/types/models/auth_rule.dart)Categories
Steps to Reproduce
@auth(rules: [{allow: owner, operations: [get]}])
or any of the granular read operationsamplify codegen models
flutter run
Screenshots
VS Code Error
Error in terminal
Platforms
Android Device/Emulator API Level
API 27
Environment
Dependencies
Device
iPhone 12
OS
macOS 13.1
Deployment Method
Amplify CLI
CLI Version
10.5.2
Additional Context
No response
Amplify Config