-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: google protobuf timestamps don't properly get suffixed when useD…
…ate=false and prefix/suffix (#1146)
- Loading branch information
Showing
6 changed files
with
375 additions
and
1 deletion.
There are no files selected for viewing
228 changes: 228 additions & 0 deletions
228
integration/suffix-usedate/google/protobuf/timestamp.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
useDate=false,typeSuffix=NoUseDateS,typePrefix=NoUseDateP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { NoUseDatePSuffixTypeNoUseDateS } from "./suffix-no-usedate-type"; | ||
|
||
describe("suffix", () => { | ||
it("generates types correctly", () => { | ||
const obj: NoUseDatePSuffixTypeNoUseDateS = { | ||
createdAt: { seconds: 1317826080, nanos: 0 }, | ||
}; | ||
expect(obj).toBeTruthy(); | ||
|
||
// make sure all conversions to and from handle prefixes and suffixes | ||
// | ||
const json = NoUseDatePSuffixTypeNoUseDateS.toJSON(obj); | ||
|
||
expect(json).toEqual({ createdAt: "2011-10-05T14:48:00.000Z" }); | ||
|
||
expect(NoUseDatePSuffixTypeNoUseDateS.fromJSON(json)).toEqual(obj); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
syntax = "proto3"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
message SuffixType { | ||
google.protobuf.Timestamp created_at = 9; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters