atuttle / Taffy

:candy: The REST Web Service framework for ColdFusion and Lucee
http://taffy.io
Other
226 stars 118 forks source link

exclude params flagged with TAFFY_DOCS_HIDE #370

Closed aliaspooryorik closed 6 years ago

aliaspooryorik commented 6 years ago

In the dashboard, check for TAFFY_DOCS_HIDE metadata on the resource argument. If it exists, do not include the argument in the constructed JSON or the dashboard docs sidebar.

Was going to use <cfcontinue> instead of nesting in a <cfif> but <cfcontinue> is CF9+ and I believe Taffy supports CF8+.

Reason for requested change.

I have arguments passed into my resource that are added in the onTaffyRequest method, so do not want them passed by the API caller. An example of this is to add a User argument parameter which is based on a header authentication token, so instead of looking it up in each resource, then I do it in onTaffyRequest. Not sure if that is a valid use case but seems to work well.

atuttle commented 6 years ago

So you're talking about extending the existing taffy_docs_hide implementation to also cover arguments for methods on otherwise visible resources? That sounds good to me.

FWIW, yes, we do (amazingly) still support CF8 but you can use continue thusly:

https://github.com/atuttle/Taffy/blob/deb269faa013ff5cff6a9d1c7c2591507e7ea879/dashboard/dashboard.cfm#L185-L187

Also illustrated there is that we prefer the colon-delimited taffy:docs:hide but also support taffy_docs_hide for platforms/versions that don't support it with colons.

Lastly, could I ask you to do the same for the methods themselves (I could see someone wanting to support e.g. a PUT but have it be undocumented), and to add support for taffy:dashboard:hide in all of the above locations as well?

I know there's a lot of little touches involved in all of that, and I appreciate your help!

aliaspooryorik commented 6 years ago

So you're talking about extending the existing taffy_docs_hide implementation to also cover arguments for methods on otherwise visible resources?

Yes, that's the idea.

Was just hacking about with it locally and thought might as well chuck up as a discussion point, so glad you like the basic idea. Will have a look at your suggestions. They all sound sensible to me. 👍

atuttle commented 6 years ago

@aliaspooryorik ping :)

aliaspooryorik commented 6 years ago

@atuttle I have been pinged! Sorry for the delay :)

Think I've added support for the suggestions you raised previously