Skip to content

Commit 7c0b2e6

Browse files
committed
chore: update dependencies in pnpm-lock.yaml to version 1.4.0 for ui components, core, and react
1 parent 72f9a87 commit 7c0b2e6

File tree

10 files changed

+16463
-2788
lines changed

10 files changed

+16463
-2788
lines changed

flutter/packages/authsome_core/lib/src/generated/api_client.dart

Lines changed: 639 additions & 2 deletions
Large diffs are not rendered by default.

flutter/packages/authsome_core/lib/src/generated/api_types.dart

Lines changed: 2256 additions & 67 deletions
Large diffs are not rendered by default.

sdk/dart/lib/src/client.dart

Lines changed: 642 additions & 146 deletions
Large diffs are not rendered by default.

sdk/dart/lib/src/types.dart

Lines changed: 2295 additions & 400 deletions
Large diffs are not rendered by default.

sdkgen/dart/generator.go

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (g *Generator) buildTemplateData(spec *openapi.Spec) *TemplateData {
202202
for _, fn := range fieldNames {
203203
fs := schema.Properties[fn]
204204
td.Fields = append(td.Fields, FieldDef{
205-
Name: toCamelCase(fn),
205+
Name: safeDartFieldName(toCamelCase(fn)),
206206
JSONName: fn,
207207
Type: g.schemaToDartType(fs),
208208
Optional: !requiredSet[fn],
@@ -495,6 +495,9 @@ func (g *Generator) renderTemplate(name string, data *TemplateData) (string, err
495495
"fromJsonExpr": buildFromJSONExpr,
496496
"toJsonExpr": buildToJSONExpr,
497497
"responseFromJson": buildResponseFromJSON,
498+
"dartStringEscape": func(s string) string {
499+
return strings.ReplaceAll(s, "$", `\$`)
500+
},
498501
}
499502

500503
tmpl, err := template.New("").Funcs(funcMap).ParseFS(templateFS, name)
@@ -543,6 +546,39 @@ func isDartReservedTypeName(name string) bool {
543546
return reserved[name]
544547
}
545548

549+
// isDartReservedKeyword returns true if the given name is a Dart language
550+
// keyword that cannot be used as a field or variable identifier.
551+
func isDartReservedKeyword(name string) bool {
552+
keywords := map[string]bool{
553+
"abstract": true, "as": true, "assert": true, "async": true,
554+
"await": true, "break": true, "case": true, "catch": true,
555+
"class": true, "const": true, "continue": true, "covariant": true,
556+
"default": true, "deferred": true, "do": true, "dynamic": true,
557+
"else": true, "enum": true, "export": true, "extends": true,
558+
"extension": true, "external": true, "factory": true, "false": true,
559+
"final": true, "finally": true, "for": true, "get": true,
560+
"if": true, "implements": true, "import": true, "in": true,
561+
"interface": true, "is": true, "late": true, "library": true,
562+
"mixin": true, "new": true, "null": true, "on": true,
563+
"operator": true, "part": true, "required": true, "rethrow": true,
564+
"return": true, "set": true, "show": true, "static": true,
565+
"super": true, "switch": true, "sync": true, "this": true,
566+
"throw": true, "true": true, "try": true, "typedef": true,
567+
"var": true, "void": true, "while": true, "with": true,
568+
"yield": true,
569+
}
570+
return keywords[name]
571+
}
572+
573+
// safeDartFieldName returns a safe Dart identifier for a field name,
574+
// appending a "$" suffix if the name is a reserved keyword.
575+
func safeDartFieldName(name string) string {
576+
if isDartReservedKeyword(name) {
577+
return name + "Value"
578+
}
579+
return name
580+
}
581+
546582
// toCamelCase converts a string to camelCase.
547583
// Handles snake_case (session_token → sessionToken) and PascalCase (Provider → provider).
548584
func toCamelCase(s string) string {
@@ -595,10 +631,8 @@ func toCamelCase(s string) string {
595631

596632
// buildFromJSONExpr generates a Dart expression to extract a field from a JSON map.
597633
func buildFromJSONExpr(jsonKey, dartType string, optional bool) string {
598-
accessor := "json['" + jsonKey + "']"
599-
if optional {
600-
accessor = "json['" + jsonKey + "']"
601-
}
634+
safeKey := strings.ReplaceAll(jsonKey, `$`, `\$`)
635+
accessor := "json['" + safeKey + "']"
602636

603637
switch dartType {
604638
case "String":

sdkgen/dart/templates/client.dart.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ class AuthClient {
8181
{{- if $op.HasBody }}
8282
{{- if isMapType $op.BodyType }}
8383
body: body,
84+
{{- else if eq $op.BodyType "Object" }}
85+
body: body is Map<String, dynamic> ? body : (body as dynamic).toJson(),
8486
{{- else }}
8587
body: body.toJson(),
8688
{{- end }}

sdkgen/dart/templates/types.dart.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class {{ .Name }} {
3030
return {
3131
{{- range .Fields }}
3232
{{- if .Optional }}
33-
if ({{ .Name }} != null) '{{ .JSONName }}': {{ toJsonExpr .Name .Type .Optional }},
33+
if ({{ .Name }} != null) '{{ dartStringEscape .JSONName }}': {{ toJsonExpr .Name .Type .Optional }},
3434
{{- else }}
35-
'{{ .JSONName }}': {{ toJsonExpr .Name .Type .Optional }},
35+
'{{ dartStringEscape .JSONName }}': {{ toJsonExpr .Name .Type .Optional }},
3636
{{- end }}
3737
{{- end }}
3838
};

sdkgen/openapi/spec.json

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3789,26 +3789,21 @@
37893789
},
37903790
"TokenResponse": {
37913791
"properties": {
3792-
"access_token": {
3792+
"session_token": {
37933793
"type": "string"
37943794
},
3795-
"expires_in": {
3796-
"type": "integer"
3797-
},
37983795
"refresh_token": {
37993796
"type": "string"
38003797
},
3801-
"scope": {
3802-
"type": "string"
3803-
},
3804-
"token_type": {
3805-
"type": "string"
3798+
"expires_at": {
3799+
"type": "string",
3800+
"format": "date-time"
38063801
}
38073802
},
38083803
"required": [
3809-
"access_token",
3810-
"token_type",
3811-
"expires_in"
3804+
"session_token",
3805+
"refresh_token",
3806+
"expires_at"
38123807
],
38133808
"type": "object"
38143809
},

0 commit comments

Comments
 (0)