Skip to content

Commit

Permalink
add flag stream-style-serialization, default to false
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft committed Nov 8, 2023
1 parent ddeb18f commit a8539c2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions typespec-extension/src/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface EmitterOptions {
"examples-directory"?: string;

"enable-sync-stack"?: boolean;
"stream-style-serialization"?: boolean;

"partial-update"?: boolean;
"custom-types"?: string;
Expand Down Expand Up @@ -74,6 +75,7 @@ const EmitterOptionsSchema: JSONSchemaType<EmitterOptions> = {
"examples-directory": { type: "string", nullable: true },

"enable-sync-stack": { type: "boolean", nullable: true, default: true },
"stream-style-serialization": { type: "boolean", nullable: true, default: false },

// customization
"partial-update": { type: "boolean", nullable: true, default: false },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ public TypeSpecPlugin(EmitterOptions options, boolean sdkIntegration) {
if (options.getEnableSyncStack() != null) {
SETTINGS_MAP.put("enable-sync-stack", options.getEnableSyncStack());
}
if (options.getStreamStyleSerialization() != null) {
SETTINGS_MAP.put("stream-style-serialization", options.getStreamStyleSerialization());
}

SETTINGS_MAP.put("sdk-integration", sdkIntegration);
SETTINGS_MAP.put("regenerate-pom", sdkIntegration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ public class EmitterOptions {
private Boolean generateSamples = true;

@JsonProperty(value = "enable-sync-stack")
private Boolean enableSyncStack;
private Boolean enableSyncStack = true;

@JsonProperty(value = "stream-style-serialization")
private Boolean streamStyleSerialization = false;

@JsonProperty(value="dev-options")
private DevOptions devOptions;
Expand Down Expand Up @@ -86,6 +89,10 @@ public Boolean getEnableSyncStack() {
return enableSyncStack;
}

public Boolean getStreamStyleSerialization() {
return streamStyleSerialization;
}

public EmitterOptions setNamespace(String namespace) {
this.namespace = namespace;
return this;
Expand Down
1 change: 1 addition & 0 deletions typespec-tests/tspconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ options:
namer: true
generate-samples: true
generate-tests: true
stream-style-serialization: true
examples-directory: "{project-root}/tsp/examples"
dev-options:
generate-code-model: true
Expand Down

0 comments on commit a8539c2

Please sign in to comment.