Thanks Ron,

For anyone who is having the same issue this is how I implemented it:

Define a model like this:
  authentication:
    title: Authentication
    type: object
    properties:
      username:
        type: string
      password:
        type: string
      pin:
        type: string


*    x-sensitive-properties:      - property: password      - property: pin*

Use extensions to indicate the sensitive fields

And then you can access them on the mustache templates with:

{{#vendorExtensions.x-sensitive-properties}}
      {{{property}}}
{{/vendorExtensions.x-sensitive-properties}}



Cumprimentos,
José Coelho


2018-04-09 11:05 GMT+01:00 Ron Ratovsky <r...@swagger.io>:

> There’s no real way of denoting a field is sensitive. That might be a use
> case for an extension.
>
>
>
>
>
>
>
> *From: *<swagger-swaggersocket@googlegroups.com> on behalf of jcoelho <
> camilocoelh...@gmail.com>
> *Reply-To: *"swagger-swaggersocket@googlegroups.com" <
> swagger-swaggersocket@googlegroups.com>
> *Date: *Monday, April 9, 2018 at 12:54
> *To: *Swagger <swagger-swaggersocket@googlegroups.com>
> *Subject: *Sensitive fields in swagger models
>
>
>
> I'm looking for a way to deal with sensitive fields (like passwords) in
> the swagger models.
>
> For example:
> I have a Credentials model:
>
> {
>   "username": "johndoe"
>   "password": "123456"
> }
>
>
> and when something goes wrong I log the exception and the input model
> using the model's toString() method.
> This means that I'm logging passwords.
>
> I've tried to set the field's property writeOnly to true (OAS 3.0) but
> that only affects the documentation not the generated code.
>
> How do you guys handle similar situations?
>
> Thank you.
> Jose
>
> --
> 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-swaggersocket+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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-swaggersocket+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to