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

Added SelectFields Method To QueryBuilder #306

Merged
merged 1 commit into from
Jan 28, 2023

Conversation

nteague22
Copy link
Contributor

@nteague22 nteague22 commented Jan 23, 2023

To implement per the HTTP API for selecting fields
API
but with a focus of applying as much of the validation through .Net exceptions as possible -- to limit runtime errors.

The main changes were:

  • added the SelectFields calls to QueryBuilder
  • added tests covering every scenario that I thought of
  • followed the spec on the API doc pages for the HTTP API
  • added comments in code to ensure flow is manageable
  • implemented an Expression Visitor to make use of the best practices for affecting and walking the Linq Expressions AST

I did add a comment that I had noticed the csproj file had the VersionPrefix set to 4.1.1, yet was using 7.2.2 on the effective fields below that. If you have not yet tried it, managing the version with dotnet pack -o <your_locals_folder> --version-suffix <some-word-or-number> is handy, as well as the built in tooling from MS uses VersionPrefix and VersionSuffix to generate the value as it is. The above call builds out the lib as contentful.net-7.2.2-prerelease-word.nupkg -- so producing a prerelease workflow is much less painful.

I can revert that change if needed, I just figured in the very least - using VersionPrefix and VersionSuffix the way I have it allows you to avoid hard Version tagging, and run the pack workflow more automatically (being able to use the dotnet cli as well as VS)

If there are any areas I did not test well enough or any sections that would need added for documentation, I would be more than happy to amend the pull request if desired.

Thanks again!

* added tests covering every scenario that I was thinking of
* followed the spec on the API doc pages for the HTTP API
* added comments in code to ensure flow is manageable
* had adjusted the csproj file where the versioning system appeared to have been out of alignment.  If this is not desired, I can revert that
@carlin-q-scott
Copy link

resolves #221

@nteague22
Copy link
Contributor Author

I know originally I had mentioned reuse of the Select, but to note this supports a single call of SelectFields per QueryBuilder, but does also match the names specified in the JsonProperty attribute, and uses the MemberExpression otherwise. I did also make sure to eagerly validate the chosen items as able, so some extent of the API spec could be tested at the unit level

@Roblinde Roblinde merged commit 2863cb0 into contentful:master Jan 28, 2023
@Roblinde
Copy link
Collaborator

High quality and excellent PR! Thank you @nteague22

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.

None yet

3 participants