Jsconfig parameter doesn't work on certain routes  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Jsconfig parameter doesn't work on certain routes

Postby SBarnes » Thu Apr 03, 2025 11:16 am

On the following route the jsconfig paramter gets ignored, this has been raised by a customer as this is happening on their api as well although routes under Queries work, so I suspect it releated to the fact that the data is being collected by the business object rather than ORM Lite and Auto Query.

For some reason they want the underscore for Ruby on Rails :cry: but I am not sure this is fixable bar trying to set the parameter globally and that might not work either.

Code: Select all
https://api.jiwa.com.au/Inventory/00000000040000000002?apikey=9vjoF4M5-gYVBWjoFyW9nlQieB9FhxpJkAsRJznB_Ok&jsconfig=EmitLowercaseUnderscoreNames:true
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Jsconfig parameter doesn't work on certain routes

Postby Mike.Sheen » Thu Apr 03, 2025 11:33 am

In a plugin in a class implementing IJiwaApplicationManagerPlugin, in the setup method just set the jsconfig property there - this will ensure all Jiwa business logic serialises with that configuration.

Code: Select all
ServiceStack.Text.JsConfig.EmitLowercaseUnderscoreNames= true;


We've done similar before to work-around the date format not being serialised as ISO8601 and it works fine.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Jsconfig parameter doesn't work on certain routes

Postby SBarnes » Thu Apr 03, 2025 11:40 am

Thanks, Mike yes, I was aware of that, but I was trying to avoid setting it that way as the client has multiple integrations against the same api where in some cases they need the underscore and in others not, hence the trying to use the query string to do it.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Jsconfig parameter doesn't work on certain routes  Topic is solved

Postby Mike.Sheen » Thu Apr 03, 2025 11:53 am

SBarnes wrote:Thanks, Mike yes, I was aware of that, but I was trying to avoid setting it that way as the client has multiple integrations against the same api where in some cases they need the underscore and in others not, hence the trying to use the query string to do it.


Ok, so then I'd try a response filter - either a typed response filter, or perhaps just a global response filter with a condition on the path - you would preserve the current value of the JSConfig property, set it to what you want and then re-serialise the DTO.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Jsconfig parameter doesn't work on certain routes

Postby SBarnes » Thu Apr 03, 2025 11:55 am

Thanks for the idea
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191


Return to REST API

Who is online

Users browsing this forum: No registered users and 2 guests