Closed barath121 closed 1 month ago
hello @barath121 , thanks for reporting the issue.
I tried reproducing the problem with below API spec. I am not able to reproduce the issue.
openapi: 3.0.0
info:
title: Hello API
version: 1.0.0
paths:
/hello:
post:
summary: Returns a greeting with the current date-time
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
requestDateTime:
type: string
format: date-time
required:
- requestDateTime
examples:
SUCCESS:
value:
requestDateTime: '2023-10-31T08:58:25.945Z'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
responseDateTime:
type: string
format: date-time
examples:
SUCCESS:
value:
responseDateTime: '2023-10-31T08:58:25.945Z'
As you can see I am using the date value that you have shared. And Specmatic is able to both run a stub server as well as contract tests based on this OpenAPI spec.
% specmatic test test.yaml --port=9000
API Specification Summary: test.yaml
OpenAPI Version: 3.0.0
API Paths: 1, API Operations: 1
Endpoints API not found, cannot calculate actual coverage
--------------------
Request to http://localhost:9000 at 2024-7-15 2:36:56.710
POST /hello
Accept-Charset: UTF-8
Accept: */*
Content-Type: application/json
{
"dateTime": "2023-10-31T08:58:25.945Z"
}
Response at 2024-7-15 2:36:56.711
200 OK
Vary: Origin
X-Specmatic-Result: success
Content-Length: 54
Content-Type: application/json
Connection: keep-alive
{
"responseDateTime": "2023-10-31T08:58:25.945Z"
}
Scenario: POST /hello -> 200 | EX:SUCCESS has SUCCEEDED
Can you please let me know if I am missing anything here?
Got it seems like issue with my setup when an invalid test case is passed it throws parsing error instead of Validation Error.
Description When parsing ISO date specmatic is throwing error.
Steps to reproduce
Expected behaviour Should parse this Date-Time when .sssZ is present.
System Information: