Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: google/googleapis.dart
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: AODocs-Dev/googleapis.dart
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jun 25, 2021

  1. Update discoveryapis_generator code to generate code that does not th…

    …row a cast exception when an API returns a property with an explicit null value (see #211)
    remideneleaodocs authored and Rémi Denèle committed Jun 25, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    41fdccd View commit details
Showing with 3 additions and 4 deletions.
  1. +3 −4 discoveryapis_generator/lib/src/dart_schemas.dart
7 changes: 3 additions & 4 deletions discoveryapis_generator/lib/src/dart_schemas.dart
Original file line number Diff line number Diff line change
@@ -842,10 +842,9 @@ class ObjectType extends ComplexDartSchemaType {
// The super variant fromJson() will call this subclass constructor
// and the variant descriminator is final.
if (!isVariantDiscriminator(property)) {
final decodeString = property.type!
.jsonDecode("_json['${escapeString(property.jsonName)}']");
fromJsonString.writeln(' if (_json.containsKey'
"('${escapeString(property.jsonName)}')) {");
final propertyValue = "_json['${escapeString(property.jsonName)}']";
final decodeString = property.type!.jsonDecode(propertyValue);
fromJsonString.writeln(' if ($propertyValue != null) {');
fromJsonString.writeln(' ${property.name} = $decodeString;');
fromJsonString.writeln(' }');
}