fix a create reporting the identifier of the request body - #629
Merged
Conversation
For a feature type whose identifier the database assigns on insert, a create
reported the value of the id column in the decoded request body instead of the
identifier the insert returned: the `Location` header of the response named a
feature that does not exist, and the per-role column overrides of a transaction
updated no row, because they are keyed on the reported identifier.
The value of the id column in a written feature is the identifier of the feature
only where the client assigns it, for example a `gml:id` decoded into an `objid`
column, where the surrogate primary key is not the identifier. Where the
database generates the identifier, a value in the request body is not inserted
at all, so the identifier is the one the insert returns.
`SqlQueryMapping.hasGeneratedId` is the rule that decides this, lifted out of
`FeatureProviderSql.hasGeneratedId`, which used it for the collection metadata
already, and applied where the mutation session determines the identifier of a
written feature.
`CreatedFeatureIdSpec` locks which id a write reports, for all four variants of the
documentation: a generated id, a client-assigned id in another column, a primary key with
`{generated=false}`, and an id the caller states. The rows and the insert statements are
stubbed, so the rule is exercised without the stream that drains the request body; the
entry point that the spec drives derives the id from the mapping, which the two callers
used to do with duplicated code.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For a feature type whose identifier the database assigns on insert, a create reported the value of the id column in the decoded request body instead of the identifier the insert returned: the
Locationheader of the response named a feature that does not exist, and the per-role column overrides of a transaction updated no row, because they are keyed on the reported identifier.The value of the id column in a written feature is the identifier of the feature only where the client assigns it, for example a
gml:iddecoded into anobjidcolumn, where the surrogate primary key is not the identifier. Where the database generates the identifier, a value in the request body is not inserted at all, so the identifier is the one the insert returns.SqlQueryMapping.hasGeneratedIdis the rule that decides this, lifted out ofFeatureProviderSql.hasGeneratedId, which used it for the collection metadata already, and applied where the mutation session determines the identifier of a written feature.CreatedFeatureIdSpeclocks which id a write reports, for all four variants of the documentation: a generated id, a client-assigned id in another column, a primary key with{generated=false}, and an id the caller states. The rows and the insert statements are stubbed, so the rule is exercised without the stream that drains the request body; the entry point that the spec drives derives the id from the mapping, which the two callers used to do with duplicated code.Note that this is an edge case where the URIs are inconsistent with the id properties.