contentful / contentful.net

.NET Library for Contentful's Content Delivery and Management API
MIT License
95 stars 55 forks source link

Added SelectFields Method To QueryBuilder #306

Closed nteague22 closed 1 year ago

nteague22 commented 1 year ago

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:

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!

carlin-q-scott commented 1 year ago

resolves #221

nteague22 commented 1 year ago

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 commented 1 year ago

High quality and excellent PR! Thank you @nteague22