Comments (4)
Feature released in v1.10.0
from open-api-mocker.
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.
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.
@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)
- html is escaped. How to unescape? HOT 2
- Wrong locale is set for faker if locale string would be de-DE or en-EN. HOT 2
- Show example in documentation, but respond with faker data HOT 1
- Faker fails in version 1.9.0 HOT 3
- Incorrect response when body is a single number HOT 8
- Let x-faker override example HOT 3
- Consider replacing faker with @faker-js/faker HOT 1
- Update node versions support HOT 1
- Match Example Request to Example Response by name HOT 1
- New release with updated Faker HOT 1
- the mock fails when extra query parameters are specified with 404, should not be the default HOT 1
- 无限打印bug
- Any solution for adding "x-faker" property in server (Nest.js)? HOT 1
- Cannot handle remote refs
- mock improvements suggestions HOT 1
- Can I mock error? HOT 2
- For long enums, the response always claims to have duplicates but there aren't any HOT 1
- Return mocked value in specified format
- Array of length 1 parsed as a string HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open-api-mocker.