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

fix(geo): update amplify config geo schema #13290

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

ashwinkumar6
Copy link
Member

@ashwinkumar6 ashwinkumar6 commented Apr 24, 2024

Description of changes

below is the ref for backend schema that generates geo amplifyOutputs

"geo": {
    "description": "Outputs manually specified by developers for use with frontend library",
    "type": "object",
    "additionalProperties": false,
    "properties": {
    "aws_region": {
        "description": "AWS Region of Amazon Location Service resources",
        "$ref": "#/$defs/aws_region"
    },
    "maps": {
        "description": "Maps from Amazon Location Service",
        "type": "object",
        "additionalProperties": false,
        "properties": {
        "items": {
            "type": "object",
            "additionalProperties": false,
            "propertyNames": {
            "description": "Amazon Location Service Map name",
            "type": "string"
            },
            "patternProperties": {
            ".*": {
                "$ref": "#/$defs/amazon_location_service_config"
            }
            }
        },
        "default": {
            "type": "string"
        }
        },
        "required": ["items", "default"]
    },
    "search_indices": {
        "description": "Location search (search by places, addresses, coordinates)",
        "type": "object",
        "additionalProperties": false,
        "properties": {
        "items": {
            "type": "array",
            "uniqueItems": true,
            "minItems": 1,
            "items": {
            "description": "Actual search name",
            "type": "string"
            }
        },
        "default": {
            "type": "string"
        }
        },
        "required": ["items", "default"]
    },
    "geofence_collections": {
        "description": "Geofencing (visualize virtual perimeters)",
        "type": "object",
        "additionalProperties": false,
        "properties": {
            "items": {
            "type": "array",
            "uniqueItems": true,
            "minItems": 1,
            "items": {
                "description": "Geofence name",
                "type": "string"
            }
            },
            "default": {
            "type": "string"
            }
        },
        "required": ["items", "default"]
    }
    },
    "required": ["aws_region"]
},

Geo.map.items (amazon_location_service_config from the config above)

"amazon_location_service_config": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
    "style": { // ====> only 'style' present here, no 'name'
        "description": "Map style",
        "type": "string"
    }
    }
}

amplify_outputs.json

"geo": {
  "aws_region": "us-west-2",
  "maps": {
    "items": {
      "myMap": {
        "style": "VectorEsriNavigation"
      }
    },
    "default": "myMap"
  },
  "geofence_collections": {
    "default": "myGeofenceCollection",
    "items": [
      "myGeofenceCollection"
    ]
  },
  "search_indices": {
    "default": "myPlaceIndex",
    "items": [
      "myPlaceIndex"
    ]
  }
}

Description of how you validated changes

Validated this change works with the geo gen2 cdk construct mentioned in docs

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ashwinkumar6 ashwinkumar6 requested review from a team as code owners April 24, 2024 19:31
@@ -51,7 +51,7 @@ export interface AmplifyOutputsStorageProperties {
export interface AmplifyOutputsGeoProperties {
aws_region: string;
maps?: {
items: Record<string, { name: string; style: string }>;
items: Record<string, unknown>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Option 1(less strict): keep type same as resource config. Similar to other categories

	maps?: {
		items: Record<string, unknown>;
		default: string;
	};

Option 2(more strict): remove name keep existing structure

	maps?: {
		items: Record<string, { style: string }>;
		default: string;
	};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going with option1, please feel free to comment otherwise

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason not to go with option 2? Seems like the cleaner solution

Copy link
Member

@ashika112 ashika112 Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we would want to do that? So the actual resource config itself is less stricter than what we had in outputsConfig and wondering if it would make sense to keep the same (consistency) since this is compiled down to ResourceConfig at the end.

Copy link
Contributor

@elorzafe elorzafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ashwinkumar6

@ashwinkumar6 ashwinkumar6 merged commit 3cca682 into aws-amplify:gen2-storage Apr 24, 2024
28 checks passed
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

Successfully merging this pull request may close these issues.

4 participants