Giter VIP home page Giter VIP logo

Comments (4)

jormaechea avatar jormaechea commented on August 20, 2024 1

Feature released in v1.10.0

from open-api-mocker.

jormaechea avatar jormaechea commented on August 20, 2024

Hi @sybrands-place, can you provide a minimal OpenAPI schema to reproduce the issue? This way I can find a solution faster.

from open-api-mocker.

sybrands-place avatar sybrands-place commented on August 20, 2024

Sure, here's an example:

  "openapi": "3.0.1",
  "info": {
    "title": "Dummy OpenAPI Mock server with nullable String",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "http://localhost:8080",
      "description": "Swagger Mock Server URL"
    }
  ],
  "paths": {
    "/dummy": {
      "get": {
        "summary": "Get dummy information",
        "operationId": "getDummyInformation",
        "responses": {
          "200": {
          "description": "OK",
          "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [ 
                    "contactpersonResponse",
                    "additionalProperties"
                  ],
                  "properties": {
                    "dummyDescription": {
                      "title": "The dummyDescription schema",
                      "type": "string",
                      "nullable": true
                    },
                    "extraDescription": {
                      "title": "The extraDescription schema",
                      "type": "object",
                      "default": {}
                    }
                  },
                  "example": {
                    "dummyDescription": null,
                    "extraDescription": {}
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

In this case with an example it works (i.e. dummyDescription becomes null), but if you remove the example the value for dummyDescription becomes "string". Perhaps this is how it should work, that it only works if you provide an example? I tried setting the default value to null, but as mentioned before then there's an error message.

EDIT: my original post might be misleading together with this message. Then it didn't work even with an example, but it was because the example was for a child element and not the complete element. So I guess that's clear to me now. I only need the verification that default doesn't work with a nullable String. Thanks for suggesting to make a simpler example, that helped! ;)

from open-api-mocker.

jormaechea avatar jormaechea commented on August 20, 2024

@sybrands-place sorry for the delay, I've been really busy. I'm now working on allowing null examples and default values, it should be ready soon.

from open-api-mocker.

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.