Handling vendor extensions into templates

15 views
Skip to first unread message

Alex Dobjanschi

unread,
Oct 21, 2016, 2:09:10 AM10/21/16
to Swagger
First of all, I'm not sure if this is a jmustache specific topic, but it pretty tied to swagger as well :)

Imagine there is a vendor extension for parameter, like this:

parameters:
 
- name: param1
    type
: string
    x
-encrypt-with: {
      algorithm
: 'sha1'
      additionalData1
: '256'
      additionalModelName
: 'param1'
   
}

There is a vendor extension whose values I'd like to use in template, but unfortunately, despite all my efforts, jmustache interprets x-encrypt-with as an iterable, as far as I've seen, and goes through all its values:

{{#allParams}}
  {{#vendorExtensions.x-encrypt-with}}
    // Value: {{this}}
  {{/vendorExtensions.x-encrypt-with}}
{{/allParams}}
 

The output is:
// Value: sha1
// Value: 256
// Value: param1

What I'd like to output is (do not iterate through Map but instead use a keyed access):
// Value: sha1, 256, param1

Thanks!



tony tam

unread,
Oct 21, 2016, 11:51:48 AM10/21/16
to swagger-sw...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex Dobjanschi

unread,
Oct 23, 2016, 4:12:16 PM10/23/16
to Swagger
In reality, vendorExtensions are not parsed in any kind, and the runtime data-type is ObjectNode, which to be honest I have no idea how to render with jmustache.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages