tangled
alpha
login
or
join now
danabra.mov
/
typelex
56
fork
atom
An experimental TypeSpec syntax for Lexicon
56
fork
atom
overview
issues
1
pulls
2
pipelines
Fix #2
danabra.mov
5 months ago
2444e063
267190ed
+12
1 changed file
expand all
collapse all
unified
split
packages
emitter
src
emitter.ts
+12
packages/emitter/src/emitter.ts
···
947
const properties: Record<string, LexObjectProperty> = {};
948
949
for (const [name, prop] of model.properties) {
0
0
0
0
0
0
0
0
0
0
0
0
950
if (!prop.optional) {
951
if (!isRequired(this.program, prop)) {
952
this.program.reportDiagnostic({
···
947
const properties: Record<string, LexObjectProperty> = {};
948
949
for (const [name, prop] of model.properties) {
950
+
// Check for conflicting @required on optional property
951
+
if (prop.optional && isRequired(this.program, prop)) {
952
+
this.program.reportDiagnostic({
953
+
code: "required-on-optional",
954
+
message:
955
+
`Property "${name}" has conflicting markers: @required decorator with optional "?". ` +
956
+
`Either remove @required to make it optional (preferred), or remove the "?".`,
957
+
target: prop,
958
+
severity: "error",
959
+
});
960
+
}
961
+
962
if (!prop.optional) {
963
if (!isRequired(this.program, prop)) {
964
this.program.reportDiagnostic({