Open

Description
When importing API through the developer portal / azure cli / azure PowerShell, example fields with format set to time
are changed to full date-time if the example schema is referenced by $ref
.
Reproduction steps
- Import the following API specification:
openapi: 3.0.3
info:
title: Time Format Test
description: Time Format Test
version: 1.0.0
servers:
- url: 'https://example.com'
paths:
/without-schema:
post:
summary: POST ISO time
operationId: post-iso-time
requestBody:
content:
application/json:
schema:
type: object
properties:
time:
type: string
format: time
example:
time:
'10:00:00+01:00'
responses:
200:
description: OK
/with-schema:
post:
summary: POST ISO time with Schema
operationId: post-iso-time-w-schema
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/IsoTime'
example:
time:
'10:00:00+01:00'
responses:
200:
description: OK
components:
schemas:
IsoTime:
type: object
properties:
time:
type: string
format: time
- Navigate to the imported API. Check the operations generated body in the Test tab.
Expected behavior
Both operations should have the following body:
{"time":"10:00:00+01:00"}
Actual behavior:
The body of the POST ISO time with Schema operation is:
{"time":"2021-12-16T09:00:00Z"}
It has been converted from ISO time to ISO date-time in UTC.
This issue prevents users from testing the API with the provided example, as the backend service expects a time, not date-time property.
This issue affects also Azure CLI, APIM REST API and Azure PowerShell.