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 Action method UrlParameters #23

Closed
wants to merge 9 commits into from

Conversation

gregveres
Copy link
Contributor

@gregveres gregveres commented Apr 22, 2021

This fixes #22

UrlParameters returns all the parameters for the action, except the on that is marked as the BodyParameter.
I have added this method because it seems impossible in the Scriban script to be able to remove a Parameter from the IEnumerable list of parameters, because once you start using the array methods, the array becomes a range and is no longer an IEnumerable so you can't do any more parameter work on it.

By providing this Action method, we remove the BodyParam in C# and we retain the type of the array.

For this commit, I added a new method to the Weather controller so that I had an example of an action that did not have a body parameter. I needed this to properly test the case without a body parameter. This addition of the method leaked into other tests because now there is an extra action to handle.

I also regenerated the documentation so that it picked up the new Action method. The strange thing about that is that it then put all the items in different orders causing a lot more change in this file than should have been.

Merge pull request NeVeSpl#18 from gregveres/master
…ffset

This fixes issue NeVeSpl#13

As pointed out in the issue, .Net Web API actually sends DateTime and DateTimeOffset back and forth between the front end and the back end as strings. This means that the best practice should be to define these values as strings.

However, Typewriter originally defined these as the JS Date object. So keeping with Typewriter's lead, we are keeping the Date object as the default, but allowing the user to specify a different value for these date types.

This commit adds another argument to ToTypeScriptType that allows the user to specify the Date type.

The unit tests have been updated as well as the documentation.  And this also affects the Parameter.ToTypeScript function as well. It also gets a new argument. (note: at this point in time there are no unit tests for Parameter.ToTypeScript)
fix for issue NeVeSpl#16 Bug: Action.Url is not using the RoutePrefix attrib…
UrlParameters returns all the parameters for the action, except the on that is marked as the BodyParameter.
I have added this method because it seems impossible in the Scriban script to be able to remove a Parameter from the IEnumerable list of parameters, because once you start using the array methods, the array becomes a range and is no longer an IEnumerable so you can't do any more parameter work on it.

By providing this Action method, we remove the BodyParam in C# and we retain the type of the array.

For this commit, I added a new method to the Weather controller so that I had an example of an action that did not have a body parameter. I needed this to properly test the case without a body parameter. This addition  of the method leaked into other tests because now there is an extra action to handle.

I also regenerated the documentation so that it picked up the new Action method. The strange thing about that is that it then put all the items in different orders causing a lot more change in this file than should have been.
@NeVeSpl NeVeSpl added the enhancement New feature or request label Apr 23, 2021
@NeVeSpl NeVeSpl added this to the 0.0.9 milestone Apr 23, 2021
Copy link
Owner

@NeVeSpl NeVeSpl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameters function returns a little bit more than those parameters used in URL. Instead of creating a new function, I would rather propose to simply add an argument: bool withoutBodyParameter = false to the existing "Parameters" function.

To get the correct order in BuiltInFunctions.md you have to run DocumentationGenerator project.

Issue NeVeSpl#15 FR: Action.ReturnType should look for ResponseType attribut…
…seType attribute when return type IHttpActionResult"

This reverts commit 3496ef7.
In reverting the UrlParameter changes, I somehow wiped out the changes of merging in 1a9a9d3.

This just brings my forked master in line with the upstream master
@gregveres
Copy link
Contributor Author

I am withdrawing this PR. It will be replaced with another request that satisfies the request and is based on a cleaner branch.

@gregveres gregveres closed this Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR: Action.Parameters without Body Parameter
2 participants