question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to set the default value for the array?

See original GitHub issue
  • swagger-ui version 2.0 the below is the part code:
      parameters:
      - in: "body"
        name: "body"
        description: ""
        required: true
        schema:
          type: "array"
          items:
            type: "string"
          default:
          - "aaaaa"
          - "bbbbb"

the code is invalid.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
hkosovacommented, Jun 8, 2017

@codepandy, if you need an example for display purposes, you can use example:

        schema:
          type: array
          items:
            type: string
          default:
          - aaaaa
          - bbbbb
          example:
          - aaaaa
          - bbbbb
0reactions
codepandycommented, Jun 9, 2017

@hkosova You are a big star,thank you very much. just use the “example” property,don’t need the “default” property.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Default Array Values in Java - GeeksforGeeks
Default Array Values in Java ; 1, boolean, false ; 2, int, 0 ; 3, double, 0.0 ; 4, String, null.
Read more >
default array values - javascript - Stack Overflow
Default value of an array is undefined . So if you want to set default to 0, you have to loop all elements...
Read more >
How to Fill an Array with Defaults - Medium
The fill() method changes all elements in an array to a default value. It begins from a start index (default 0 ) to...
Read more >
Default array values in Java - Tutorialspoint
When an array is created without assigning it any elements, compiler assigns them the default value. Following are the examples:
Read more >
Setting Array Default Values - NI - National Instruments
Right-click an element in the array and select Data Operations»Make Current Value Default or Data Operations»Reinitialize to Default Value from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found