Coder Social home page Coder Social logo

Comments (9)

mjgolinski avatar mjgolinski commented on September 27, 2024

I checked it myself - it isn't supported. For us it's a showstopper because we have lots of maps in our API

from pyswagger.

mission-liao avatar mission-liao commented on September 27, 2024

Interesting, I didn't see that property shown in the spec of Swagger 2.0. Let's me check how it works.

from pyswagger.

mission-liao avatar mission-liao commented on September 27, 2024

Just found I asked similar question in Google Groups....

I tend to provide a partial support on additionalProperties for your case.

The problem is, this property contains 2 different types of value: a boolean or a Schema object.
To support what you need, I just need to support additionalProperties with a Schema object, which is easier.

The boolean case would be resolved later but not now, is that OK?
You could check the progress in this branch https://github.com/mission-liao/pyswagger/tree/addp

from pyswagger.

mission-liao avatar mission-liao commented on September 27, 2024

Here is the testing case I would use in this case, let me know if this is not what you expected.

{
   "swagger":"2.0",
   "host":"http://test.com",
   "basePath":"/v1",
   "paths":{

   },
   "definitions":{
      "Category":{
         "properties":{
            "id":{
               "type":"integer",
               "format":"int64"
            },
            "name":{
               "type":"string"
            }
         }
      },
      "add_prop":{
         "properties":{
            "name_of_map":{
               "type":"string"
            }
         },
         "additionalProperties":{
            "$ref":"#/definitions/Category"
         }
      }
   }
}

from pyswagger.

mjgolinski avatar mjgolinski commented on September 27, 2024

Just to confirm, following JSON should fit your schema:

{
    "name_of_map": "my map",
    "prop1": {
        "id": 1,
        "name": "property 1"
    },
    "prop2": {
        "id": 2,
        "name": "property no. 2"
    },
}

If so, it's exactly what I need.
BTW could I also define additionalProperties inline (as opposed to using $ref)?

from pyswagger.

mission-liao avatar mission-liao commented on September 27, 2024

Sure, it will works when inlined.

from pyswagger.

mission-liao avatar mission-liao commented on September 27, 2024

Just create a PR, will be merged once we finished your PR.

from pyswagger.

mission-liao avatar mission-liao commented on September 27, 2024

Just merge to master, will give a new build once Json_Reference is done.

from pyswagger.

mission-liao avatar mission-liao commented on September 27, 2024

Just update a new build on pypi, you could verify this issue with new build.

For adding support on type:'number' or 'integer' without format, I gonna provide some way for users to register their own primitive handlers.

from pyswagger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.