Skip to content

Commit

Permalink
fix(specs): ingestion push task payload [skip-bc] (#3607)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Millot <[email protected]>
  • Loading branch information
shortcuts and millotp authored Aug 29, 2024
1 parent cdd6f0d commit 327e08d
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 66 deletions.
20 changes: 19 additions & 1 deletion specs/ingestion/paths/tasks/v2/pushTask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,25 @@ post:
content:
application/json:
schema:
$ref: '../../../../common/schemas/Batch.yml#/batchWriteParams'
title: pushTaskPayload
type: object
properties:
action:
$ref: '../../../../common/schemas/Batch.yml#/action'
records:
type: array
items:
title: pushTaskRecords
type: object
additionalProperties: true
required:
- objectID
properties:
objectID:
$ref: '../../../../common/parameters.yml#/objectID'
required:
- action
- records
required: true
responses:
'200':
Expand Down
7 changes: 6 additions & 1 deletion templates/csharp/tests/generateInnerParams.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@
{{#isObject}}
{{#oneOfModel}}new {{{parentClassName}}}({{/oneOfModel}}new {{{objectName}}}{
{{#value}}
{{#isAdditionalProperty}}AdditionalProperties = new Dictionary<string, object>{ {"{{{key}}}", {{> tests/generateParams}} } }{{/isAdditionalProperty}}
{{^isAdditionalProperty}}{{#lambda.pascalcase}}{{#lambda.csharpIdentifier}}{{&key}}{{/lambda.csharpIdentifier}}{{/lambda.pascalcase}} = {{> tests/generateParams}},{{/isAdditionalProperty}}{{/value}}
{{#hasAdditionalProperties}}
AdditionalProperties = new Dictionary<string, object>{
{{#value}}
{{#isAdditionalProperty}} {"{{{key}}}", {{> tests/generateParams}} },{{/isAdditionalProperty}}{{/value}}
}
{{/hasAdditionalProperties}}
}{{#oneOfModel}}){{/oneOfModel}}
{{/isObject}}
{{#isFreeFormObject}}
Expand Down
8 changes: 4 additions & 4 deletions templates/go/model_simple.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (o *{{classname}}) Get{{name}}Ok() ({{^isArray}}{{^isFreeFormObject}}*{{/is
{{#deprecated}}
// Deprecated
{{/deprecated}}
func (o *{{classname}}) Set{{name}}(v {{#isModel}}*{{/isModel}}{{vendorExtensions.x-go-base-type}}) *{{classname}} {
func (o *{{classname}}) Set{{name}}(v {{#isModel}}{{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}{{/isModel}}{{vendorExtensions.x-go-base-type}}) *{{classname}} {
{{#isNullable}}
{{#vendorExtensions.x-golang-is-container}}
o.{{name}} = v
Expand All @@ -133,7 +133,7 @@ func (o *{{classname}}) Set{{name}}(v {{#isModel}}*{{/isModel}}{{vendorExtension
{{/vendorExtensions.x-golang-is-container}}
{{/isNullable}}
{{^isNullable}}
o.{{name}} = {{#isModel}}*{{/isModel}}v
o.{{name}} = {{#isModel}}{{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}{{/isModel}}v
{{/isNullable}}
return o
}
Expand Down Expand Up @@ -200,7 +200,7 @@ func (o *{{classname}}) Has{{name}}() bool {
{{#deprecated}}
// Deprecated
{{/deprecated}}
func (o *{{classname}}) Set{{name}}(v {{#isModel}}*{{/isModel}}{{vendorExtensions.x-go-base-type}}) *{{classname}} {
func (o *{{classname}}) Set{{name}}(v {{#isModel}}{{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}{{/isModel}}{{vendorExtensions.x-go-base-type}}) *{{classname}} {
{{#isNullable}}
{{#vendorExtensions.x-golang-is-container}}
o.{{name}} = v
Expand Down Expand Up @@ -443,4 +443,4 @@ func (o {{classname}}) String() string {
}
{{/isAdditionalPropertiesTrue}}
return fmt.Sprintf("{{classname}} {\n%s}", out)
}
}
24 changes: 1 addition & 23 deletions templates/kotlin/snippets/method.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,7 @@ class Snippet{{client}} {
val client = {{client}}(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY"{{#hasRegionalHost}}, region = "YOUR_APP_ID_REGION"{{/hasRegionalHost}})

// Call the API
var response = client.{{method}}(
{{#parametersWithDataType}}
{{> tests/request_param}}
{{/parametersWithDataType}}
{{#hasRequestOptions}}
requestOptions = RequestOptions(
{{#requestOptions.queryParameters}}
urlParameters = buildMap {
{{#parametersWithDataType}}
put("{{{key}}}", {{> tests/param_value}})
{{/parametersWithDataType}}
},
{{/requestOptions.queryParameters}}
{{#requestOptions.headers}}
headers = buildMap {
{{#parametersWithDataType}}
put("{{{key}}}", {{> tests/param_value}})
{{/parametersWithDataType}}
},
{{/requestOptions.headers}}
)
{{/hasRequestOptions}}
)
var response = client.{{> tests/method}}

// Use the response
println(response)
Expand Down
6 changes: 1 addition & 5 deletions templates/kotlin/tests/client/method.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
client.{{method}}(
{{#parametersWithDataType}}
{{> tests/request_param}}
{{/parametersWithDataType}}
)
client.{{> tests/method}}
6 changes: 1 addition & 5 deletions templates/kotlin/tests/client/tests.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ fun `{{#lambda.replaceBacktick}}{{{testName}}}{{/lambda.replaceBacktick}}`() = r
{{#isMethod}}
client.runTest(
call = {
{{method}}(
{{#parametersWithDataType}}
{{> tests/request_param}}
{{/parametersWithDataType}}
)
{{> tests/method}}
},
{{#match}}
{{^testResponse}}
Expand Down
7 changes: 6 additions & 1 deletion templates/kotlin/tests/param_object.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{{{objectName}}}(
{{#value}}
{{> tests/request_param}}
{{^isAdditionalProperty}}
{{#hasAdditionalProperties}}{{#lambda.camelcase}}{{{key}}}{{/lambda.camelcase}} = {{/hasAdditionalProperties}}{{> tests/request_param}}
{{/isAdditionalProperty}}
{{/value}}
{{#hasAdditionalProperties}}
additionalProperties = mapOf({{#value}}{{#isAdditionalProperty}}"{{key}}" to {{> tests/param_json_element}}{{/isAdditionalProperty}}{{/value}})
{{/hasAdditionalProperties}}
)
2 changes: 1 addition & 1 deletion templates/kotlin/tests/request_param.mustache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{^isAdditionalProperty}}{{#lambda.camelcase}}{{{key}}}{{/lambda.camelcase}} = {{> tests/param_value}}{{/isAdditionalProperty}}{{#isAdditionalProperty}}additionalProperties = mapOf("{{key}}" to {{> tests/param_json_element}}){{/isAdditionalProperty}}
{{^hasAdditionalProperties}}{{#lambda.camelcase}}{{{key}}}{{/lambda.camelcase}} = {{> tests/param_value}}{{/hasAdditionalProperties}}{{#hasAdditionalProperties}}{{> tests/param_value}}{{/hasAdditionalProperties}}
8 changes: 7 additions & 1 deletion templates/scala/tests/param_object.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{{{objectName}}}(
{{#value}}
{{> tests/request_param}},
{{^isAdditionalProperty}}
{{#lambda.scalaIdentifier}}{{&key}}{{/lambda.scalaIdentifier}} = {{> tests/param_optional}},
{{/isAdditionalProperty}}
{{/value}}
{{#hasAdditionalProperties}}
additionalProperties = Some(List({{#value}}{{#isAdditionalProperty}}JField("{{key}}", {{> tests/param_json_element}}),
{{/isAdditionalProperty}}{{/value}}))
{{/hasAdditionalProperties}}
)
2 changes: 1 addition & 1 deletion templates/scala/tests/request_param.mustache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{^isAdditionalProperty}}{{#lambda.scalaIdentifier}}{{&key}}{{/lambda.scalaIdentifier}} = {{> tests/param_optional}}{{/isAdditionalProperty}}{{#isAdditionalProperty}}additionalProperties = Some(List(JField("{{key}}", {{> tests/param_json_element}}))){{/isAdditionalProperty}}
{{^hasAdditionalProperties}}{{#lambda.scalaIdentifier}}{{&key}}{{/lambda.scalaIdentifier}} = {{> tests/param_optional}}{{/hasAdditionalProperties}}{{#hasAdditionalProperties}}{{> tests/param_value}}{{/hasAdditionalProperties}}
40 changes: 17 additions & 23 deletions tests/CTS/requests/ingestion/pushTask.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@
{
"parameters": {
"taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
"batchWriteParams": {
"requests": [
"pushTaskPayload": {
"action": "addObject",
"records": [
{
"action": "addObject",
"body": {
"key": "bar",
"foo": "1"
}
"key": "bar",
"foo": "1",
"objectID": "o"
},
{
"action": "addObject",
"body": {
"key": "baz",
"foo": "2"
}
"key": "baz",
"foo": "2",
"objectID": "k"
}
]
}
Expand All @@ -25,20 +22,17 @@
"path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f/push",
"method": "POST",
"body": {
"requests": [
"action": "addObject",
"records": [
{
"action": "addObject",
"body": {
"key": "bar",
"foo": "1"
}
"key": "bar",
"foo": "1",
"objectID": "o"
},
{
"action": "addObject",
"body": {
"key": "baz",
"foo": "2"
}
"key": "baz",
"foo": "2",
"objectID": "k"
}
]
}
Expand Down

0 comments on commit 327e08d

Please sign in to comment.