summaryrefslogtreecommitdiff
path: root/csharp
AgeCommit message (Collapse)Author
2015-12-02Handle JSON parsing for Any.Jon Skeet
This required a rework of the tokenizer to allow for a "replaying" tokenizer, basically in case the @type value comes after the data itself. This rework is nice in some ways (all the pushback and object depth logic in one place) but is a little fragile in terms of token push-back when using the replay tokenizer. It'll be fine for the scenario we need it for, but we should be careful...
2015-12-02JSON formatting for Any.Jon Skeet
2015-11-22Generated code changes for previous commit (basically ↵Jon Skeet
InternalBuildGeneratedFileFrom => FromGeneratedCode)
2015-11-22Tidy up reflection in advance of attempting to implement DynamicMessage.Jon Skeet
There are corner cases where MessageDescriptor.{ClrType,Parser} will return null, and these are now documented. However, normally they *should* be implemented, even for descriptors of for dynamic messages. Ditto FieldDescriptor.Accessor. We'll still need a fair amount of work to implement dynamic messages, but this change means that the public API will be remain intact. Additionally, this change starts making use of C# 6 features in the files that it touches. This is far from exhaustive, and later PRs will have more. Generated code changes coming in the next commit.
2015-11-21Added the type registry in advance of implementing Any support.Jon Skeet
Biting off just this bit first as I don't need the changes from a previous PR for this part.
2015-11-19Merge pull request #988 from gabikliot/CSharp-SampleUsage-Big-FixJan Tattermusch
Fixed a bug in CSharp SampleUsage.
2015-11-19Removed redundant comment.Gabriel Kliot
2015-11-19Finished an implementation commentJon Skeet
2015-11-19Generated code from previous commit.Jon Skeet
2015-11-19Introduce a Parser property into MessageDescriptor, and populate it from ↵Jon Skeet
generated types. Generated code coming in next commit - in a subsequent PR I want to do a bit of renaming and redocumenting around this, in anticipation of DynamicMessage.
2015-11-18Fixed a bug in CSharp SampleUsage.Gabriel Kliot
2015-11-09Generated code changes and manual changes for previous commit.Jon Skeet
2015-11-06Generated code for previous commit.Jon Skeet
2015-11-05Merge pull request #941 from jskeet/recursion-limitJan Tattermusch
Add recursion limit handling to JSON parsing.
2015-11-05Reimplement JSON recursion by detecting the depth in the tokenizer.Jon Skeet
Added a TODO around a possible change to the tokenizer API, changing PushBack(token) into just Rewind() or something similar.
2015-11-05Merge pull request #940 from jskeet/json-namesJon Skeet
Move the creation of the "fields by JSON name" dictionary to the descriptor
2015-11-05Created a new exception for JSON failures.Jon Skeet
This is only thrown directly by JsonTokenizer, but surfaces from JsonParser as well. I've added doc comments to hopefully make everything clear. The exception is actually thrown by the reader within JsonTokenizer, in anticipation of keeping track of the location within the document, but that change is not within this PR.
2015-11-04Add recursion limit handling to JSON parsing.Jon Skeet
Fixes issue #932.
2015-11-04Move the creation of the "fields by JSON name" dictionary to the descriptor.Jon Skeet
2015-11-03Implement JSON parsing in C#.Jon Skeet
This includes all the well-known types except Any. Some aspects are likely to require further work when the details of the JSON parsing expectations are hammered out in more detail. Some of these have "ignored" tests already. Note that the choice *not* to use Json.NET was made for two reasons: - Going from 0 dependencies to 1 dependency is a big hit, and there's not much benefit here - Json.NET parses more leniently than we'd want; accommodating that would be nearly as much work as writing the tokenizer This only really affects the JsonTokenizer, which could be replaced by Json.NET. The JsonParser code would be about the same length with Json.NET... but I wouldn't be as confident in it.
2015-11-02Make BytesString.Unsafe internal (which it should have been all along)Jon Skeet
2015-10-30Fix clearing wrapper type fields with reflection.Jon Skeet
The nullable value type fields already worked, but the use of the CLR property concealed the difference between string and StringWrapper fields.
2015-10-24Generated code for previous commit (oneof case contributing to hash code and ↵Jon Skeet
equality).
2015-10-24Include the oneof-case in equality and hash code generated code.Jon Skeet
The included C# test will fail until the regenerated code is used, which is in the next commit.
2015-10-07Merge pull request #846 from jskeet/tostringJon Skeet
Support ToString in RepeatedField and MapField.
2015-10-01Support ToString in RepeatedField and MapField.Jon Skeet
This changes how we approach JSON formatting in general - instead of looking at the field a value came from, we just look at the type of the value. It's possible this *could* be slightly inefficient, but if we start caring about JSON performance deeply, we'll probably want to rewrite all of this anyway. It's definitely simpler this way. When we support dynamic messages, we'll need to modify JsonFormatter to handle enum values, as they won't come be "real" .NET enums at that point. It shouldn't be hard to do though.
2015-10-01Generated code from previous commit.Jon Skeet
2015-09-30Fix typo in oneof case enum commentJon Skeet
2015-09-29Generated code changes for previous commit.Jon Skeet
2015-09-29Generated code for previous commitJon Skeet
2015-09-29Added documentation to generated code.Jon Skeet
There are now summaries for: - The Types nested class (which holds nested types) - The file descriptor class for each proto - The enum generated for each oneof (Also fixed two typos.) Generated code in next commit.
2015-09-23Merge pull request #785 from jskeet/csharp-directoriesJan Tattermusch
Generate C# directory hierarchy with new option
2015-09-04Pack/Unpack implementation for Any.Jon Skeet
We still need the JSON representation, which relies on something like a DescriptorPool to fetch message types from based on the type URL. That will come a bit later. (The DescriptorPool comment in this commit is just a note which will prove useful if we use DescriptorPool itself.)
2015-09-01Regenerated code. Most changes are whitespace, removing trailing spaces.Jon Skeet
Other changes are due to the well-known types changing without us regenerating.
2015-09-01Generate a directory hierarchy based on namespace (C#)Jon Skeet
This introduces a new C# option, base_namespace. If the option is not specified, the behaviour is as before: no directories are generated. If the option *is* specified, all C# namespaces must be relative to the base namespace, and the directories are generated relative to that namespace. Example: - Any.proto declares csharp_namespace = "Google.Protobuf.WellKnownTypes" - We build with --csharp_out=Google.Protobuf --csharp_opt=base_namespace=Google.Protobuf - The Any.cs file is generated in Google.Protobuf/WellKnownTypes (where it currently lives) We need a change to descriptor.proto before this will all work (it wasn't in the right C# namespace) but that needs the other descriptors to be regenerated too. See next commit...
2015-08-26Update README.md for C#Jan Tattermusch
2015-08-26Merge pull request #738 from jtattermusch/include_descriptor_protoJon Skeet
Include descriptor.proto in nuget package
2015-08-25include descriptor.proto in nuget packageJan Tattermusch
2015-08-25Remove extraneous TODOJon Skeet
2015-08-25Change where we rename Descriptor.cs to DescriptorProtoFile.cs.Jon Skeet
We now do this in protoc instead of the generation simpler. Benefits: - Generation script is simpler - Detection is simpler as we now only need to care about one filename - The embedded descriptor knows itself as "google/protobuf/descriptor.proto" avoiding dependency issues This PR also makes the "invalid dependency" exception clearer in terms of expected and actual dependencies.
2015-08-14fix type initialization problem with FileDescriptorJan Tattermusch
2015-08-14add a failing descriptor testJan Tattermusch
2015-08-14remove duplicate test caseJan Tattermusch
2015-08-13Allow public access to descriptor.proto as a dependency.Jon Skeet
With this in place, generating APIs on github.com/google/googleapis works - previously annotations.proto failed. Currently there's no access to the annotations (stored as extensions) but we could potentially expose those at a later date.
2015-08-10More TODOs done.Jon Skeet
- Removed a TODO without change in DescriptorPool.LookupSymbol - the TODOs were around performance, and this is only used during descriptor initialization - Make the CodedInputStream limits read-only, adding a static factory method for the rare cases when this is useful - Extracted IDeepCloneable into its own file.
2015-08-10Merge pull request #701 from jskeet/map-viewsJon Skeet
Implement Keys and Values as views in MapField
2015-08-10Fix parameter name in exception.Jon Skeet
2015-08-10Implement ICollection.CopyTo (using Array) for MapField views.Jon Skeet
2015-08-08Implement Keys and Values as viewsJon Skeet
2015-08-08Make FieldDescriptor.IsPacked work appropriately.Jon Skeet
This is a bit of a grotty hack, as we need to sort of fake proto2 field presence, but with only a proto3 version of the descriptor messages (a bit like oneof detection). Should be okay, but will need to be careful of this if we ever implement proto2.