atuttle / Taffy

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

Add mime type for taffy as MS Azure Scim endpoint #391

Closed rscRoman closed 4 years ago

atuttle commented 4 years ago

This change seems innocuous enough on the surface, but one of the beautiful things about Taffy's architecture is that you can build on top of it.

In this case, you could create a cfc named OurCustomNativeJsonDeserializer.cfc and put it in your resources folder. Tell taffy to use it by setting variables.framework.deserializer as follows:

variables.framework = {
    deserializer: "OurCustomNativeJsonDeserializer"
};

And implementing that CFC would be as simple as:

<cfcomponent extends="taffy.core.nativeJsonDeserializer">
    <cffunction name="getFromJson" output="false" taffy:mime="application/json,text/json,application/scim+json" hint="get data from json">
        <cfreturn super.getFromJson( argumentCollection: arguments ) />
    </cffunction>
</cfcomponent>

That said, is there some reason that adding this application/scim+json mime type as a default would be beneficial to the average user? I'm not familiar with Azure or SCIM so it's hard for me to make that judgement call.

rscRoman commented 4 years ago

Thanks for the reply. No, i don't think that this PR would benefit the average user. You'd only will, if you use Taffy as Azure SCIM endpoint as i do. But in my case i can absolutely extend Taffy with a custom cfc. Will close the PR.