The 2.0 specification doesn’t allow setting additionalProperties: false. It was 
intended to be the default definition but was never clarified in the spec.

 

 

 

From: <[email protected]> on behalf of Yuting 
<[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Thursday, September 28, 2017 at 00:15
To: Swagger <[email protected]>
Subject: How do I use swagger api to generate swagger with additionalProperties 
as false for object

 

I somehow have to generate a swagger doc with addtionalProperties as false to 
not allow additional properties.  I looked at 
https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-models/src/main/java/io/swagger/models/ModelImpl.java

but setAdditionalProperties accept a Property only, how do I set it with a 
boolean value?
public void setAdditionalProperties(Property additionalProperties) {
 

type(OBJECT);
 

this.additionalProperties = additionalProperties;
}


"TestDTO" : {
      "type" : "object",
      "additionalProperties":false
      "properties" : {
        "property1" : {
          "description" : "This is a test object.",
          "$ref" : "#/definitions/TestDTO"
        },
        "perperty2" : {
          "type" : "string",
          "description" : "this is a property."
        }
      }
    },

-- 
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 [email protected].
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to