@team-supercharge/oasg 16.7.1-temp-feat-swift-openapi-generator-58887187 → 16.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1048,6 +1048,27 @@ Validations from OpenAPI spec:
1048
1048
  | packageName | Name of the generated package | Y | - |
1049
1049
  | generatorCustomArgs | Custom arguments of the generator (--global-property, --additional-properties) | N | - |
1050
1050
 
1051
+ #### `dotnet-webapi`
1052
+
1053
+ ```json
1054
+ {
1055
+ "id": "dotnet-webapi",
1056
+ "type": "dotnet-webapi",
1057
+ "source": "source-merged",
1058
+ "sourceUrl": "https://api.nuget.org/v3/index.json",
1059
+ "apiKey": "apiKey",
1060
+ "packageName": "packageName",
1061
+ "generatorCustomArgs": "--global-property=supportingFiles,modelDocs --additional-properties=nullableReferenceTypes=false"
1062
+ }
1063
+ ```
1064
+
1065
+ | Parameter | Description | Required | Default |
1066
+ | ------------------- | ------------------------------------------------------------------------------ | -------- | ------- |
1067
+ | sourceUrl | Url to where the package will be published | Y | - |
1068
+ | packageName | Name of the generated package | Y | - |
1069
+ | apiKey | Api key of nuget source (If not specified, provide the CI_JOB_TOKEN) | N | - |
1070
+ | generatorCustomArgs | Custom arguments of the generator (--global-property, --additional-properties) | N | - |
1071
+
1051
1072
  #### `postman`
1052
1073
 
1053
1074
  ```json
package/bin/oasg CHANGED
@@ -55,7 +55,8 @@ const DEFAULT_GENERATOR_MAPPING = {
55
55
  "spring-kotlin": { version: '7.11.0', generator: 'kotlin-spring' },
56
56
  "python-fastapi": { version: '7.8.0', generator: 'python-fastapi' },
57
57
  "python-fastapi-raw-request": { version: '7.0.1', generator: 'python-fastapi' },
58
- "dotnet": { version: '7.8.0', generator: 'csharp-functions' },
58
+ "dotnet": { version: '7.11.0', generator: 'csharp-functions' },
59
+ "dotnet-webapi": { version: '7.11.0', generator: 'aspnetcore' },
59
60
  // misc targets
60
61
  "contract-testing": { version: '4.3.1', generator: 'typescript-node' },
61
62
  "openapi": { version: undefined, generator: undefined },
package/config.schema.yml CHANGED
@@ -31,6 +31,7 @@ properties:
31
31
  - $ref: '#/targets/Flutter'
32
32
  - $ref: '#/targets/Kmp'
33
33
  - $ref: '#/targets/Dotnet'
34
+ - $ref: '#/targets/DotnetWebApi'
34
35
  - $ref: '#/targets/Postman'
35
36
  - $ref: '#/targets/TypeScriptAxios'
36
37
  - $ref: '#/targets/TypeScriptFetch'
@@ -451,6 +452,22 @@ targets:
451
452
  - apiKey
452
453
  - packageName
453
454
 
455
+ DotnetWebApi:
456
+ allOf:
457
+ - $ref: '#/targets/Base'
458
+ - properties:
459
+ type:
460
+ pattern: '^dotnet-webapi$'
461
+ sourceUrl:
462
+ type: string
463
+ apiKey:
464
+ type: string
465
+ packageName:
466
+ type: string
467
+ required:
468
+ - sourceUrl
469
+ - packageName
470
+
454
471
  Kmp:
455
472
  allOf:
456
473
  - $ref: '#/targets/Base'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-supercharge/oasg",
3
- "version": "16.7.1-temp-feat-swift-openapi-generator-58887187",
3
+ "version": "16.8.0",
4
4
  "description": "Node-based tool to lint OpenAPI documents and generate clients, servers and documentation from them",
5
5
  "author": "Supercharge",
6
6
  "license": "MIT",
@@ -4,20 +4,18 @@ source $(dirname "$0")/../common.sh
4
4
 
5
5
  cd out/$targetId
6
6
 
7
+ # install dotnet
8
+ wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
9
+ chmod +x dotnet-install.sh
10
+ ./dotnet-install.sh --channel 6.0 --install-dir "$HOME/.dotnet"
11
+ export PATH="$HOME/.dotnet:$PATH"
12
+
7
13
  # pack
8
14
  dotnet restore
9
15
  dotnet build -c Release
10
16
  dotnet pack -c Release -p:Version=$version -p:IsPackable=true
11
17
 
12
- isWindows=false
13
- if [[ "$OSTYPE" == "cygwin"* ]] || [[ "$OSTYPE" == "msys"* ]]; then
14
- isWindows=true
15
- fi
16
- storePasswordOption=$([[ $isWindows == true ]] && echo "" || echo "--store-password-in-clear-text")
17
-
18
18
  # publish
19
- echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><configuration></configuration>" > nuget.config
20
- dotnet nuget add source "${sourceUrl}" -n Feed -u User -p "${apiKey}" --configfile nuget.config $storePasswordOption
21
- dotnet nuget push "src/**/bin/Release/*.nupkg" -s ${sourceUrl} -k AZ
19
+ dotnet nuget push "src/**/bin/Release/*.nupkg" --source $sourceUrl -k ${apiKey:-$CI_JOB_TOKEN}
22
20
 
23
21
  cd ../..
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+
3
+ source $(dirname "$0")/../common.sh
4
+
5
+ rm -rf out/$targetId
6
+ mkdir -p out/$targetId
7
+
8
+ java -jar $binary generate \
9
+ -g $generatorId \
10
+ -i $openApiFile \
11
+ -t $templateDir \
12
+ -o out/$targetId \
13
+ -c $(dirname "$0")/generator-config.json \
14
+ -p "packageVersion=$version,packageName=$packageName" \
15
+ $generatorCustomArgs
@@ -0,0 +1,17 @@
1
+ {
2
+ "inlineSchemaOptions": {
3
+ "ARRAY_ITEM_SUFFIX": "",
4
+ "MAP_ITEM_SUFFIX": "",
5
+ "SKIP_SCHEMA_REUSE": "true"
6
+ },
7
+ "additionalProperties": {
8
+ "aspnetCoreVersion": "8.0",
9
+ "operationIsAsync": true,
10
+ "buildTarget": "library",
11
+ "generateBody": false,
12
+ "nullableReferenceTypes": true,
13
+ "operationResultTask": true,
14
+ "enumNameSuffix": "",
15
+ "enumValueSuffix": ""
16
+ }
17
+ }
@@ -0,0 +1,21 @@
1
+ #!/bin/bash
2
+
3
+ source $(dirname "$0")/../common.sh
4
+
5
+ cd out/$targetId
6
+
7
+ # install dotnet
8
+ wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
9
+ chmod +x dotnet-install.sh
10
+ ./dotnet-install.sh --channel 8.0 --install-dir "$HOME/.dotnet"
11
+ export PATH="$HOME/.dotnet:$PATH"
12
+
13
+ # pack
14
+ dotnet restore
15
+ dotnet build -c Release
16
+ dotnet pack -c Release -p:Version=$version -p:IsPackable=true
17
+
18
+ # publish
19
+ dotnet nuget push "src/**/bin/Release/*.nupkg" --source $sourceUrl -k ${apiKey:-$CI_JOB_TOKEN}
20
+
21
+ cd ../..
@@ -0,0 +1,198 @@
1
+ {{>partial_header}}
2
+ using System;
3
+ using System.Linq;
4
+ using System.Text;
5
+ using System.Collections.Generic;
6
+ using System.ComponentModel;
7
+ using System.ComponentModel.DataAnnotations;
8
+ using System.Runtime.Serialization;
9
+ {{#useNewtonsoft}}
10
+ using Newtonsoft.Json;
11
+ {{/useNewtonsoft}}
12
+ {{^useNewtonsoft}}
13
+ using System.Text.Json;
14
+ {{/useNewtonsoft}}
15
+ {{#models}}
16
+ {{#model}}
17
+ {{#discriminator}}
18
+ using JsonSubTypes;
19
+ {{#useSwashbuckle}}
20
+ using Swashbuckle.AspNetCore.Annotations;
21
+ {{/useSwashbuckle}}
22
+ {{/discriminator}}
23
+ {{/model}}
24
+ {{/models}}
25
+ using {{packageName}}.Converters;
26
+
27
+ {{#models}}
28
+ {{#model}}
29
+ namespace {{modelPackage}}
30
+ { {{#isEnum}}{{>enumClass}}{{/isEnum}}{{^isEnum}}
31
+ /// <summary>
32
+ /// {{description}}
33
+ /// </summary>
34
+ [DataContract]
35
+ {{#discriminator}}
36
+ {{#useNewtonsoft}}
37
+ {{#mappedModels.size}}
38
+ [JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")]
39
+ {{/mappedModels.size}}
40
+ {{/useNewtonsoft}}
41
+ {{#useSwashbuckle}}
42
+ [SwaggerDiscriminator("{{{discriminatorName}}}")]
43
+ {{/useSwashbuckle}}
44
+ {{#mappedModels}}
45
+ [JsonSubtypes.KnownSubType(typeof({{{modelName}}}), "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")]
46
+ {{#useSwashbuckle}}
47
+ [SwaggerSubType(typeof({{{modelName}}}), DiscriminatorValue = "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")]
48
+ {{/useSwashbuckle}}
49
+ {{/mappedModels}}
50
+ {{/discriminator}}
51
+ public {{#modelClassModifier}}{{.}} {{/modelClassModifier}}class {{classname}} {{#parent}}: {{{.}}}{{^pocoModels}}, {{/pocoModels}}{{/parent}}{{^pocoModels}}{{^parent}}: {{/parent}}IEquatable<{{classname}}>{{/pocoModels}}
52
+ {
53
+ {{#vars}}
54
+ {{#items.isEnum}}
55
+ {{#items}}
56
+ {{^complexType}}
57
+ {{>enumClass}}
58
+ {{/complexType}}
59
+ {{/items}}
60
+ {{/items.isEnum}}
61
+ {{#isEnum}}
62
+ {{^complexType}}
63
+ {{>enumClass}}
64
+ {{/complexType}}
65
+ {{/isEnum}}
66
+ /// <summary>
67
+ /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
68
+ /// </summary>{{#description}}
69
+ /// <value>{{.}}</value>{{/description}}{{#example}}
70
+ /* <example>{{.}}</example> */{{/example}}{{#required}}
71
+ [Required]{{/required}}{{#pattern}}
72
+ [RegularExpression("{{{.}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}
73
+ [StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}}
74
+ [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}}
75
+ [MaxLength({{.}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}
76
+ [Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}
77
+ [DataMember(Name="{{baseName}}", EmitDefaultValue={{#isNullable}}true{{/isNullable}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}true{{/vendorExtensions.x-is-value-type}}{{^vendorExtensions.x-is-value-type}}false{{/vendorExtensions.x-is-value-type}}{{/isNullable}})]
78
+ {{#isEnum}}
79
+ public {{{datatypeWithEnum}}}{{#isNullable}}{{^required}}?{{/required}}{{/isNullable}} {{name}} { get; set; }{{#defaultValue}} = {{{.}}};{{/defaultValue}}
80
+ {{/isEnum}}
81
+ {{^isEnum}}
82
+ public {{{dataType}}}{{#nullableReferenceTypes}}{{^isContainer}}{{^required}}{{^isNullable}}?{{/isNullable}}{{/required}}{{/isContainer}}{{/nullableReferenceTypes}} {{name}} { get; set; }{{#defaultValue}} = {{{.}}};{{/defaultValue}}
83
+ {{/isEnum}}
84
+ {{^-last}}
85
+
86
+ {{/-last}}
87
+ {{/vars}}
88
+
89
+ {{^pocoModels}}
90
+ /// <summary>
91
+ /// Returns the string presentation of the object
92
+ /// </summary>
93
+ /// <returns>String presentation of the object</returns>
94
+ public override string ToString()
95
+ {
96
+ var sb = new StringBuilder();
97
+ sb.Append("class {{classname}} {\n");
98
+ {{#vars}}
99
+ sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
100
+ {{/vars}}
101
+ sb.Append("}\n");
102
+ return sb.ToString();
103
+ }
104
+
105
+ /// <summary>
106
+ /// Returns the JSON string presentation of the object
107
+ /// </summary>
108
+ /// <returns>JSON string presentation of the object</returns>
109
+ public {{#parent}}{{^isMap}}{{^isArray}}new {{/isArray}}{{/isMap}}{{/parent}}string ToJson()
110
+ {
111
+ {{#useNewtonsoft}}
112
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
113
+ {{/useNewtonsoft}}
114
+ {{^useNewtonsoft}}
115
+ var options = new JsonSerializerOptions
116
+ {
117
+ WriteIndented = true
118
+ };
119
+
120
+ return JsonSerializer.Serialize(this, options);
121
+ {{/useNewtonsoft}}
122
+ }
123
+
124
+ /// <summary>
125
+ /// Returns true if objects are equal
126
+ /// </summary>
127
+ /// <param name="obj">Object to be compared</param>
128
+ /// <returns>Boolean</returns>
129
+ public override bool Equals(object obj)
130
+ {
131
+ if (obj is null) return false;
132
+ if (ReferenceEquals(this, obj)) return true;
133
+ return obj.GetType() == GetType() && Equals(({{classname}})obj);
134
+ }
135
+
136
+ /// <summary>
137
+ /// Returns true if {{classname}} instances are equal
138
+ /// </summary>
139
+ /// <param name="other">Instance of {{classname}} to be compared</param>
140
+ /// <returns>Boolean</returns>
141
+ public bool Equals({{classname}} other)
142
+ {
143
+ if (other is null) return false;
144
+ if (ReferenceEquals(this, other)) return true;
145
+
146
+ return {{#vars}}{{^isContainer}}
147
+ (
148
+ {{name}} == other.{{name}} ||
149
+ {{^vendorExtensions.x-is-value-type}}{{name}} != null &&{{/vendorExtensions.x-is-value-type}}
150
+ {{name}}.Equals(other.{{name}})
151
+ ){{^-last}} && {{/-last}}{{/isContainer}}{{#isContainer}}
152
+ (
153
+ {{name}} == other.{{name}} ||
154
+ {{^vendorExtensions.x-is-value-type}}{{name}} != null &&
155
+ other.{{name}} != null &&
156
+ {{/vendorExtensions.x-is-value-type}}{{name}}.SequenceEqual(other.{{name}})
157
+ ){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}false{{/vars}};
158
+ }
159
+
160
+ /// <summary>
161
+ /// Gets the hash code
162
+ /// </summary>
163
+ /// <returns>Hash code</returns>
164
+ public override int GetHashCode()
165
+ {
166
+ unchecked // Overflow is fine, just wrap
167
+ {
168
+ var hashCode = 41;
169
+ // Suitable nullity checks etc, of course :)
170
+ {{#vars}}
171
+ {{^vendorExtensions.x-is-value-type}}if ({{name}} != null){{/vendorExtensions.x-is-value-type}}
172
+ hashCode = hashCode * 59 + {{name}}.GetHashCode();
173
+ {{/vars}}
174
+ return hashCode;
175
+ }
176
+ }
177
+
178
+ #region Operators
179
+ #pragma warning disable 1591
180
+
181
+ public static bool operator ==({{classname}} left, {{classname}} right)
182
+ {
183
+ return Equals(left, right);
184
+ }
185
+
186
+ public static bool operator !=({{classname}} left, {{classname}} right)
187
+ {
188
+ return !Equals(left, right);
189
+ }
190
+
191
+ #pragma warning restore 1591
192
+ #endregion Operators
193
+ {{/pocoModels}}
194
+ }
195
+ {{/isEnum}}
196
+ {{/model}}
197
+ {{/models}}
198
+ }