Skip to content

Conversation

@0marperez
Copy link
Contributor

Issue #

closes #1044

Description of changes

-Added IgnoreKey with key __type to descriptors when deserializing a union shape for AWS Json protocols
(AWS Json 1.0, AWS Json 1.1, RestJson 1.0)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@0marperez 0marperez marked this pull request as ready for review September 27, 2023 14:11
@0marperez 0marperez requested a review from a team as a code owner September 27, 2023 14:11
import software.amazon.smithy.model.shapes.MemberShape
import software.amazon.smithy.model.shapes.Shape

class AwsJsonProtocolParserGenerator(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix Missing documentation.

Should we rename this (and AwsJsonProtocolSerdeDescriptorGenerator) since these aren't specific to the "aws json" protocols? It's a bit confusing but I also don't know that I have a better suggestion at the moment. At the very least we should document that this isn't specific to awsJson protocols.

import software.amazon.smithy.model.shapes.MemberShape
import software.amazon.smithy.model.shapes.Shape

class AwsJsonProtocolSerdeDescriptorGenerator(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docs

{
"id": "ac672b00-f8bb-4235-8db4-aad0ae2f157d",
"type": "bugfix",
"description": "ignore __type when deserializing union for AWS Json protocols",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also applies for RestJSON, so I wouldn't say just "AWS Json protocols"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: consider wrapping __type in backticks: __type


/**
* Adds a trait to ignore `__type` in union shapes for `AWS Json 1.0`, `AWS Json 1.1`, `RestJson 1.0` protocols
* Sometimes the unnecessary trait `__type` is added and needs to be ignored
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "Sometimes the unnecessary field `__type` is added and needs to be ignored"

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
32.8% 32.8% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@0marperez 0marperez merged commit f8a73cc into main Sep 28, 2023
@0marperez 0marperez deleted the ignore-type-unions-aws-json-protocols branch September 28, 2023 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignore __type field when deserializing unions in JSON protocols

4 participants