koopjs / FeatureServer

An open source Geoservices Implementation (deprecated)
https://geoservices.github.io
Other
104 stars 32 forks source link

Fix inconsistent args with FeatureLayerMetadata.create and QueryFields.create #241

Closed schmidtk closed 2 years ago

schmidtk commented 2 years ago

This resolves a couple bugs related to how options are normalized in various parts of the library.

The first is explained in #240, but essentially FeatureLayerMetadata.create calls TableLayerMetadata.normalizeInput with inconsistent options. The normalize call expects the layerId to be under req.params.layer (this is the case when making a layer request), but when requesting layers metadata from the /layers endpoint the layerId is under req.layerId.

https://github.com/koopjs/FeatureServer/blob/878c38ffd3ec65870a22df0ee209f3015cf8866d/lib/helpers/table-layer-metadata.js#L27-L32

https://github.com/koopjs/FeatureServer/blob/878c38ffd3ec65870a22df0ee209f3015cf8866d/lib/layers-metadata.js#L10-L12

The normalizeOptions call for QueryFields/Fields does not expect a data property. The fields within data are expected to be directly in the inputOptions. https://github.com/koopjs/FeatureServer/blob/878c38ffd3ec65870a22df0ee209f3015cf8866d/lib/helpers/fields/fields.js#L10-L20

For the queryRelatedRecords case, two input arguments are passed when only one is expected (inputOptions).

Resolves #240.

rgwozdz commented 2 years ago

Thanks @schmidtk, much appreciated. All that is needed is a entry in the CHANGELOG.md under ## Unreleased. Once added, I will merge and publish.

schmidtk commented 2 years ago

Thanks @rgwozdz, added notes to the changelog. Let me know if you need anything further.

rgwozdz commented 2 years ago

published in featureserver@4.0.2