csharpfritz / InstantAPIs

A library that generates Minimal API endpoints for an Entity Framework context.
MIT License
448 stars 57 forks source link

39-Add PUT methods for the JSON-first APIs #63

Closed davidbuckleyni closed 2 years ago

davidbuckleyni commented 2 years ago

Hi @csharpfritz @softchris Let me no if anything else needs done I added a enum value Put=24 We might need to change that number but saw you just doing multiples of 2 for the values.

Fixes #39

verbedr commented 2 years ago

The value of [Flags] enabled enum should be a value of 2 to the power of x where x is a positive natural number. So in this case it should be 32. But then again the value of All should be the sum of all the above.

In general I tend to assign 1 << 0, 1 << 1, 1 << 2 and use int.MaxValue as the value for All. (see for example https://stackoverflow.com/questions/3999922/why-use-the-bitwise-shift-operator-for-values-in-a-c-enum-definition)

Anyway Update and Put are synonyms. Perhaps you should use the Update value of that enum

davidbuckleyni commented 2 years ago

The value of [Flags] enabled enum should be a value of 2 to the power of x where x is a positive natural number. So in this case it should be 32. But then again the value of All should be the sum of all the above.

In general I tend to assign 1 << 0, 1 << 1, 1 << 2 and use int.MaxValue as the value for All. (see for example https://stackoverflow.com/questions/3999922/why-use-the-bitwise-shift-operator-for-values-in-a-c-enum-definition)

Anyway Update and Put are synonyms. Perhaps you should use the Update value of that enum

I was thinking that but what if the program wants to no their is a dif between the update and the put via the enum just thinking out loud here but could catch. The main reason I didn't put it to 32 was because ALL is already at 32. @verbedr

csharpfritz commented 2 years ago

Agreed with @verbedr - the PUT HTTP verb is the same as update and should reference the Update enum.

Let's consolidate on the ApisToGenerate.Update value and then we can accept this

davidbuckleyni commented 2 years ago

Agreed with @verbedr - the PUT HTTP verb is the same as update and should reference the Update enum.

Let's consolidate on the ApisToGenerate.Update value and then we can accept this

Ok Wil do that this evening then then put it on thru.

davidbuckleyni commented 2 years ago

Sorry forgot to tag and say done @csharpfritz

csharpfritz commented 2 years ago

Thank you for that update! This was a good addition