-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
test(core): catch type issues when configuring from external json #14101
Open
ashwinkumar6
wants to merge
3
commits into
aws-amplify:main
Choose a base branch
from
ashwinkumar6:outputs-type-unit-test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+221
−1
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
207 changes: 207 additions & 0 deletions
207
packages/core/__tests__/singleton/utils/amplify_outputs.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
{ | ||
"version": "1", | ||
"auth": { | ||
"aws_region": "us-west-2", | ||
"user_pool_id": "mock-cup-id", | ||
"user_pool_client_id": "mock-cup-client-id", | ||
"identity_pool_id": "mock-idp-id", | ||
"authentication_flow_type": "CUSTOM_AUTH", | ||
"oauth": { | ||
"identity_providers": [ | ||
"FACEBOOK", | ||
"SIGN_IN_WITH_APPLE", | ||
"GOOGLE", | ||
"Auth0" | ||
], | ||
"domain": "mock-oauth-domain", | ||
"scopes": ["phone"], | ||
"redirect_sign_in_uri": ["mock-sign-in-uri"], | ||
"redirect_sign_out_uri": ["mock-sign-out-uri"], | ||
"response_type": "token" | ||
}, | ||
"standard_required_attributes": ["address", "locale", "email"], | ||
"username_attributes": ["phone_number", "email"], | ||
"user_verification_types": ["email"], | ||
"unauthenticated_identities_enabled": true, | ||
"mfa_configuration": "OPTIONAL", | ||
"mfa_methods": ["TOTP", "SMS"], | ||
"password_policy": { | ||
"require_lowercase": true, | ||
"require_numbers": true, | ||
"require_uppercase": true, | ||
"require_symbols": true, | ||
"min_length": 6 | ||
}, | ||
"groups": [ | ||
ashwinkumar6 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
"ADMIN": { "precedence": 0 }, | ||
"USER": { "precedence": 1 } | ||
}, | ||
{ | ||
"USER": { "precedence": 0 } | ||
}, | ||
{ | ||
"TEST": { "precedence": 2 }, | ||
"USER": { "precedence": 1 }, | ||
"ADMIN": { "precedence": 0 } | ||
} | ||
] | ||
}, | ||
"data": { | ||
"aws_region": "us-west-2", | ||
"url": "mock-data-url", | ||
"api_key": "mock-data-api-key", | ||
"default_authorization_type": "API_KEY", | ||
"authorization_types": [], | ||
"conflict_resolution_mode": "AUTOMERGE", | ||
"model_introspection": { | ||
"version": 1, | ||
"models": { | ||
"Todo": { | ||
"name": "Todo", | ||
"fields": { | ||
"id": { | ||
"name": "id", | ||
"isArray": false, | ||
"type": "ID", | ||
"isRequired": true, | ||
"attributes": [] | ||
}, | ||
"content": { | ||
"name": "content", | ||
"isArray": false, | ||
"type": "String", | ||
"isRequired": false, | ||
"attributes": [] | ||
}, | ||
"createdAt": { | ||
"name": "createdAt", | ||
"isArray": false, | ||
"type": "AWSDateTime", | ||
"isRequired": false, | ||
"attributes": [], | ||
"isReadOnly": true | ||
}, | ||
"updatedAt": { | ||
"name": "updatedAt", | ||
"isArray": false, | ||
"type": "AWSDateTime", | ||
"isRequired": false, | ||
"attributes": [], | ||
"isReadOnly": true | ||
} | ||
}, | ||
"syncable": true, | ||
"pluralName": "Todos", | ||
"attributes": [ | ||
{ | ||
"type": "model", | ||
"properties": {} | ||
}, | ||
{ | ||
"type": "auth", | ||
"properties": { | ||
"rules": [ | ||
{ | ||
"provider": "userPools", | ||
"ownerField": "owner", | ||
"allow": "owner", | ||
"identityClaim": "cognito:username", | ||
"operations": ["create", "update", "delete", "read"] | ||
}, | ||
{ | ||
"allow": "private", | ||
"provider": "iam", | ||
"operations": ["create", "update", "delete", "read"] | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"primaryKeyInfo": { | ||
"isCustomPrimaryKey": false, | ||
"primaryKeyFieldName": "id", | ||
"sortKeyFieldNames": [] | ||
} | ||
} | ||
}, | ||
"enums": {}, | ||
"nonModels": {} | ||
} | ||
}, | ||
"geo": { | ||
"aws_region": "us-west-2", | ||
"search_indices": { | ||
"items": ["mock-geo-search-item", "mock-geo-search-item-alt"], | ||
"default": "mock-geo-search-item" | ||
}, | ||
"geofence_collections": { | ||
"items": ["mock-geo-fence-item", "mock-geo-fence-item-alt"], | ||
"default": "mock-geo-fence-item" | ||
}, | ||
|
||
"maps": { | ||
"items": { | ||
"map51addb38-dev": { | ||
"style": "VectorEsriStreets" | ||
}, | ||
"map30grxcw31-prod": { | ||
"style": "VectorEsriStreets" | ||
} | ||
}, | ||
"default": "map51addb38-dev" | ||
} | ||
}, | ||
"custom": { | ||
"custom-prop": -51806024, | ||
"custom-prop-alt": 87599986, | ||
"events": { | ||
"url": "mock-events-url", | ||
"aws_region": "us-west-2", | ||
"default_authorization_type": "API_KEY", | ||
"api_key": "mock-events-api-key" | ||
} | ||
}, | ||
"notifications": { | ||
"aws_region": "us-west-2", | ||
"amazon_pinpoint_app_id": "mock-pinpoint-app-id", | ||
"channels": ["IN_APP_MESSAGING", "APNS"] | ||
}, | ||
"analytics": { | ||
"amazon_pinpoint": { | ||
"app_id": "mock-pinpoint-app-id", | ||
"aws_region": "us-west-2" | ||
} | ||
}, | ||
"storage": { | ||
"aws_region": "us-west-2", | ||
"bucket_name": "mock-bucket-1", | ||
"buckets": [ | ||
{ | ||
"name": "mock-bucket-1", | ||
"bucket_name": "bucket1", | ||
"aws_region": "us-west-2", | ||
"paths": { | ||
"sub/*": { | ||
"authenticated": ["get", "list"] | ||
}, | ||
"public/*": { | ||
"guest": ["get", "list", "write", "delete"], | ||
"authenticated": ["write", "get", "list", "delete"] | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "mock-bucket-2", | ||
"bucket_name": "bucket2", | ||
"aws_region": "us-west-2", | ||
"paths": { | ||
"public/*": { | ||
"guest": ["get", "list", "write", "delete"], | ||
"authenticated": ["write", "get", "list", "delete"] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't quite get this - are we validating all possible fields are contained in the amplify_outputs.json file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep exactly, when a new optional key is added in AmplifyOutputs we want to make sure the
mockAmplifyOutputs
used here is also updated to include this field. With this approach if amplify_outputs isn't updated this line would cribThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. amplify_outputs.json will be updated manually? Is there any checks too that the manual update conforms to CLI JSON schema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 we need to figure out a way to make sure our outputs.json conforms to CLI schema.Might be out of scope for this PR.