Skip to content

Conversation

@jeremyhayes
Copy link
Contributor

@jeremyhayes jeremyhayes commented Nov 13, 2018

Description

Adds an example value provider for "date" format strings.

Given:

"properties": {
   "myDateField": {
      "type":"string", 
      "format":"date"
   }
}

Should provide an example ISO-formatted date-only string, such as

"2018-11-13"

Motivation and Context

Previously, these fields would be represented in request/response "Example Value" payloads as simply "string". This change provides semantic context, similar to other primitive values (number, boolean, etc).

How Has This Been Tested?

Added unit tests to cover sample values for both "date" and "date-time" formats.

Screenshots (if appropriate):

Checklist

My PR contains...

  • No code changes (src/ is unmodified: changes to documentation, CI, metadata, etc.)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fixes (non-breaking change which fixes an issue)
  • Improvements (misc. changes to existing features)
  • Features (non-breaking change which adds functionality)

My changes...

  • are breaking changes to a public API (config options, System API, major UI change, etc).
  • are breaking changes to a private API (Redux, component props, utility functions, etc.).
  • are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
  • are not breaking changes.

Documentation

  • My changes do not require a change to the project documentation.
  • My changes require a change to the project documentation.
  • If yes to above: I have updated the documentation accordingly.

Automated tests

  • My changes can not or do not need to be tested.
  • My changes can and should be tested by unit and/or integration tests.
  • If yes to above: I have added tests to cover my changes.
  • If yes to above: I have taken care to cover edge cases in my tests.
  • All new and existing tests passed.

@jeremyhayes jeremyhayes force-pushed the string-date-example-value branch from 588fa86 to c1713e8 Compare November 13, 2018 23:17
@jeremyhayes jeremyhayes force-pushed the string-date-example-value branch from c1713e8 to d8258b7 Compare November 13, 2018 23:20
Copy link
Contributor

@shockey shockey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪

@shockey shockey merged commit 078bca3 into swagger-api:master Nov 15, 2018
@shockey
Copy link
Contributor

shockey commented Nov 15, 2018

thanks @jeremyhayes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants