Update typescript open API generator to handle the IntOrString type (#213)
* Update typescript open API generator to handle the IntOrString type * remove trailing comma
This commit is contained in:
@@ -121,7 +121,7 @@ def strip_401_response(operation, _):
|
||||
def transform_to_csharp_stream_response(operation, _):
|
||||
if operation.get('operationId', None) == 'readNamespacedPodLog' or operation.get('x-kubernetes-action', None) == 'connect':
|
||||
operation['responses']['200']["schema"] = {
|
||||
"type": "object",
|
||||
"type": "object",
|
||||
"format": "file" ,
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ def process_swagger(spec, client_language, crd_mode=False):
|
||||
|
||||
# force to autorest to generate stream
|
||||
apply_func_to_spec_operations(spec, transform_to_csharp_stream_response)
|
||||
# force to consume json if */*
|
||||
# force to consume json if */*
|
||||
apply_func_to_spec_operations(spec, transform_to_csharp_consume_json)
|
||||
|
||||
apply_func_to_spec_operations(spec, strip_delete_collection_operation_watch_params)
|
||||
@@ -235,6 +235,8 @@ def preserved_primitives_for_language(client_language):
|
||||
return ["intstr.IntOrString", "resource.Quantity", "v1.Patch"]
|
||||
elif client_language == "haskell-http-client":
|
||||
return ["intstr.IntOrString", "resource.Quantity"]
|
||||
elif client_language == "typescript":
|
||||
return ["intstr.IntOrString"]
|
||||
else:
|
||||
return []
|
||||
|
||||
@@ -254,8 +256,8 @@ def type_for_language(client_language):
|
||||
return {"v1.Patch": { "type": "string"}}
|
||||
elif client_language == "csharp":
|
||||
return {
|
||||
"v1.Patch": { "type": "object", "properties": {"content": { "type": "object"}} },
|
||||
"resource.Quantity": { "type": "object", "properties": {"value": { "type": "string"}} },
|
||||
"v1.Patch": { "type": "object", "properties": {"content": { "type": "object"}} },
|
||||
"resource.Quantity": { "type": "object", "properties": {"value": { "type": "string"}} },
|
||||
"intstr.IntOrString" : { "type": "object", "properties": {"value": { "type": "string"}} },
|
||||
}
|
||||
else:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.kubernetes</groupId>
|
||||
@@ -22,6 +22,9 @@
|
||||
<inputSpec>${generator.spec.path}</inputSpec>
|
||||
<skipValidateSpec>true</skipValidateSpec>
|
||||
<generatorName>typescript-node</generatorName>
|
||||
<importMappings>
|
||||
IntOrString=../../types
|
||||
</importMappings>
|
||||
<output>${generator.output.path}</output>
|
||||
<configOptions>
|
||||
<sortParamsByRequiredFlag>true</sortParamsByRequiredFlag>
|
||||
@@ -30,6 +33,7 @@
|
||||
<npmVersion>${generator.client.version}</npmVersion>
|
||||
<modelPropertyNaming>original</modelPropertyNaming>
|
||||
</configOptions>
|
||||
<typeMappings>int-or-string=IntOrString</typeMappings>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
Reference in New Issue
Block a user