aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.36k stars 2.1k forks source link

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

Closed ashwinkumar6 closed 3 weeks ago

ashwinkumar6 commented 3 weeks ago

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.