Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to set default value with utcDateTime.fromISO("2024-02-15T18:36:03Z") #4193

Closed
4 tasks done
skywing918 opened this issue Aug 15, 2024 · 1 comment
Closed
4 tasks done
Assignees
Labels
emitter:openapi3 Issues for @typespec/openapi3 emitter feature New feature or request triaged:core

Comments

@skywing918
Copy link
Member

Describe the bug

throw: error @typespec/openapi3/invalid-default Invalid type 'ScalarValue' for a default value :1:1

import "@typespec/http";
import "@typespec/openapi3";
using Http;
using TypeSpec.OpenAPI;
@service
namespace test;

scalar utcDateTime {
  init fromISO(value: string);
}

model DateRange {
  minDate: utcDateTime = utcDateTime.fromISO("2024-02-15T18:36:03Z");
}

Reproduction

Playground

Checklist

@skywing918 skywing918 added the bug Something isn't working label Aug 15, 2024
@markcowl markcowl added the emitter:openapi3 Issues for @typespec/openapi3 emitter label Aug 19, 2024
@markcowl markcowl added this to the [2024] September milestone Aug 19, 2024
@timotheeguerin
Copy link
Member

Not sure I would qualify that one as a bug as much as a missing feature. Default values have always only supported primitive types.

@AlitzelMendez AlitzelMendez self-assigned this Sep 9, 2024
@AlitzelMendez AlitzelMendez changed the title [Bug]: Failed to set default value with utcDateTime.fromISO("2024-02-15T18:36:03Z") Failed to set default value with utcDateTime.fromISO("2024-02-15T18:36:03Z") Sep 13, 2024
@AlitzelMendez AlitzelMendez added feature New feature or request and removed bug Something isn't working labels Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:openapi3 Issues for @typespec/openapi3 emitter feature New feature or request triaged:core
Projects
None yet
Development

No branches or pull requests

4 participants