-
Notifications
You must be signed in to change notification settings - Fork 0
[Java] [Spring] mixed OneOf support with inheritance and JsonUnwrapped #3
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
Changes from all commits
7e41eaf
401bba6
930fc30
4f1bc49
f87ef87
dd59b06
bbca9cf
800646d
21b0969
389f52c
2c46d6b
2afbbbf
dfdc5ae
0a1225e
578c9d9
af5b49d
aceeabb
e6e66c0
a3bdef7
2ae3b13
4a2601d
0a549a8
400a0d6
44b6862
9cac97a
9b6c308
442a1eb
14540e1
e83d3ba
6a0da9b
c22c0f5
7a14a43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,7 +166,7 @@ import {{packageName}}.auth.* | |
| } | ||
| this.method = requestConfig.method.httpMethod | ||
| headers.filter { header -> !UNSAFE_HEADERS.contains(header.key) }.forEach { header -> this.header(header.key, header.value) } | ||
| if (requestConfig.method in listOf(RequestMethod.PUT, RequestMethod.POST, RequestMethod.PATCH)) { | ||
| if (requestConfig.method in listOf(RequestMethod.PUT, RequestMethod.POST, RequestMethod.PATCH, RequestMethod.DELETE)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This adds DELETE to the body-handling branch, so every DELETE request now sets Content-Type: application/json and calls setBody(body) even when there is no request body (body == null). For the common bodyless DELETE case this means the client now advertises a JSON content type where it previously sent none. Some servers treat a Content-Type on a bodyless DELETE differently (e.g. rejecting/415 on requests that shouldn't carry a body), so this is a client behavior change beyond the intended 'support DELETE request bodies' goal. Consider only setting the content type and body when a body is actually present, or scope the header emission to requests that carry a body, to keep bodyless DELETE requests unchanged while still enabling DELETEs that send a body. Prompt for AI agents |
||
| val contentType = (requestConfig.headers[HttpHeaders.ContentType]?.let { ContentType.parse(it) } | ||
| ?: ContentType.Application.Json) | ||
| this.contentType(contentType) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,30 @@ import { type {{modelName}}, {{modelName}}FromJSONTyped, {{modelName}}ToJSON, {{ | |
| export function instanceOf{{classname}}(value: object): value is {{classname}} { | ||
| {{#vars}} | ||
| {{#required}} | ||
| {{#hasSanitizedName}} | ||
| if ((!('{{name}}' in value) && !('{{baseName}}' in value)) || (value['{{name}}'] === undefined && value['{{baseName}}'] === undefined)) return false; | ||
| {{/hasSanitizedName}} | ||
| {{^hasSanitizedName}} | ||
| if (!('{{name}}' in value) || value['{{name}}'] === undefined) return false; | ||
| {{/hasSanitizedName}} | ||
| {{#isEnum}} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: The new singleton-enum check in Prompt for AI agents |
||
| {{#allowableValues}} | ||
| {{#values}} | ||
| {{#-first}} | ||
| {{#-last}} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: OneOf branches with multi-value enum tags can still deserialize as the first structurally matching model because these guards emit no value check unless the enum is a singleton. The generated guard should test membership against every allowed enum value. Prompt for AI agents |
||
| {{#hasSanitizedName}} | ||
| {{#isString}}if (value['{{name}}'] !== '{{.}}' && value['{{baseName}}'] !== '{{.}}') return false;{{/isString}} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Objects containing both wire and sanitized property names can be classified into the wrong OneOf branch when only the sanitized alias has the expected enum value; conversion then consumes the conflicting wire value. The guard should prioritize Prompt for AI agents |
||
| {{^isString}}if (value['{{name}}'] !== {{.}} && value['{{baseName}}'] !== {{.}}) return false;{{/isString}} | ||
| {{/hasSanitizedName}} | ||
| {{^hasSanitizedName}} | ||
| {{#isString}}if (value['{{name}}'] !== '{{.}}') return false;{{/isString}} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Singleton string enum values containing apostrophes or other escaped characters can produce invalid or incorrect generated TypeScript because Prompt for AI agents |
||
| {{^isString}}if (value['{{name}}'] !== {{.}}) return false;{{/isString}} | ||
| {{/hasSanitizedName}} | ||
| {{/-last}} | ||
| {{/-first}} | ||
| {{/values}} | ||
| {{/allowableValues}} | ||
| {{/isEnum}} | ||
| {{/required}} | ||
| {{/vars}} | ||
| return true; | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: HTTP-signature clients targeting the supported
net47framework no longer compile: the constructor referencesRuntimeInformation, which is unavailable in the .NET Framework 4.7 reference assemblies. Guarding this initialization withNETCOREAPPpreserves the new behavior where it is used without breakingnet47generation.Prompt for AI agents