Skip to content

Commit

Permalink
Merge branch 'main' into fix/default-scope
Browse files Browse the repository at this point in the history
  • Loading branch information
baywet authored Mar 20, 2024
2 parents b18682e + c4e2406 commit f7eaaae
Show file tree
Hide file tree
Showing 19 changed files with 763 additions and 8 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

## [1.1.1] - 2024-03-20

### Changed

- Fixed a bug where not providing scopes to `AzureIdentityAccessTokenProvider` failed with `UnsupportedOperationException` when attempting to fetch the token. [microsoftgraph/msgraph-sdk-java#1882](https://github.com/microsoftgraph/msgraph-sdk-java/issues/1882)

## [1.1.0] - 2024-02-14

### Added

- Adds support for untyped nodes.

## [1.0.6] - 2023-03-04

### Changed
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.microsoft.kiota.serialization;

import jakarta.annotation.Nonnull;

/**
* Represents an untyped node with a collection of other untyped nodes.
*/
public class UntypedArray extends UntypedNode {
/**
* The constructor for the UntypedArray
* @param collection Collection to initialize with.
*/
public UntypedArray(@Nonnull Iterable<UntypedNode> collection) {
value = collection;
}

private final Iterable<UntypedNode> value;

/**
* Gets the value assigned to untyped node.
* @return The string value of the node.
*/
@Override
@Nonnull public Iterable<UntypedNode> getValue() {
return value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.microsoft.kiota.serialization;

import jakarta.annotation.Nonnull;

/**
* Represents an untyped node with boolean value.
*/
public class UntypedBoolean extends UntypedNode {
/**
* The constructor for the UntypedBoolean
* @param boolValue Boolean to create node with.
*/
public UntypedBoolean(@Nonnull Boolean boolValue) {
value = boolValue;
}

private final Boolean value;

/**
* Gets the value assigned to untyped node.
* @return The bool value of the node.
*/
@Override
@Nonnull public Boolean getValue() {
return value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.microsoft.kiota.serialization;

import jakarta.annotation.Nonnull;

import java.math.BigDecimal;

/**
* Represents an untyped node with decimal value.
*/
public class UntypedDecimal extends UntypedNode {
/**
* The constructor for the UntypedDecimal
* @param decimalValue The decimal to create the node with.
*/
public UntypedDecimal(@Nonnull BigDecimal decimalValue) {
value = decimalValue;
}

private final BigDecimal value;

/**
* Gets the value assigned to untyped node.
* @return The BigDecimal value of the node.
*/
@Override
@Nonnull public BigDecimal getValue() {
return value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.microsoft.kiota.serialization;

import jakarta.annotation.Nonnull;

/**
* Represents an untyped node with double value.
*/
public class UntypedDouble extends UntypedNode {
/**
* The constructor for the UntypedDouble
* @param doubleValue The Double to create the node with.
*/
public UntypedDouble(@Nonnull Double doubleValue) {
value = doubleValue;
}

private final Double value;

/**
* Gets the value assigned to untyped node.
* @return The double value of the node.
*/
@Override
@Nonnull public Double getValue() {
return value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.microsoft.kiota.serialization;

import jakarta.annotation.Nonnull;

/**
* Represents an untyped node with Float value.
*/
public class UntypedFloat extends UntypedNode {
/**
* The constructor for the UntypedFloat
* @param floatValue The float value to create the node with.
*/
public UntypedFloat(@Nonnull Float floatValue) {
value = floatValue;
}

private final Float value;

/**
* Gets the value assigned to untyped node.
* @return The float value of the node.
*/
@Override
@Nonnull public Float getValue() {
return value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.microsoft.kiota.serialization;

import jakarta.annotation.Nonnull;

/**
* Represents an untyped node with integer value.
*/
public class UntypedInteger extends UntypedNode {
/**
* The constructor for the UntypedObject
* @param intValue The integer to create the node with.
*/
public UntypedInteger(@Nonnull Integer intValue) {
value = intValue;
}

private final Integer value;

/**
* Gets the value assigned to untyped node.
* @return The integer value of the node.
*/
@Override
@Nonnull public Integer getValue() {
return value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.microsoft.kiota.serialization;

import jakarta.annotation.Nonnull;

/**
* Represents an untyped node with Long value.
*/
public class UntypedLong extends UntypedNode {
/**
* The constructor for the UntypedLong
* @param longValue The long value to create the node with.
*/
public UntypedLong(@Nonnull Long longValue) {
value = longValue;
}

private final Long value;

/**
* Gets the value assigned to untyped node.
* @return The long value of the node.
*/
@Override
@Nonnull public Long getValue() {
return value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.microsoft.kiota.serialization;

import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;

/**
* Base class for untyped node.
*/
public class UntypedNode implements Parsable {

/**
* The deserialization information for the current model.
* @return The map of serializer methods for this object.
*/
@Nonnull @Override
public Map<String, Consumer<ParseNode>> getFieldDeserializers() {
return new HashMap<>();
}

/**
* Serializes the current object
*/
@Override
public void serialize(@Nonnull SerializationWriter writer) {
// no properties to serialize. This is handled by custom serialization logic.
}

/**
* Gets the value assigned to untyped node.
* @return The value assigned to untyped node.
*/
@Nullable public Object getValue() {
throw new UnsupportedOperationException(
"getValue is implemented for derived types of UntypedNode");
}

/**
* Creates a new instance of the appropriate class based on discriminator value.
* @param parseNode The parse node to crate from
* @return A new UntypedNode instance.
*/
@Nonnull public static UntypedNode createFromDiscriminatorValue(@Nonnull final ParseNode parseNode) {
return new UntypedNode();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.microsoft.kiota.serialization;

import jakarta.annotation.Nullable;

/**
* Represents an untyped node with null value.
*/
public class UntypedNull extends UntypedNode {
/**
* The default constructor for the UntypedNull
*/
public UntypedNull() {
// empty constructor
}

/**
* Gets the value assigned to untyped node.
* @return null value.
*/
@Override
@Nullable public Object getValue() {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.microsoft.kiota.serialization;

import jakarta.annotation.Nonnull;

import java.util.HashMap;
import java.util.Map;

/**
* Represents an untyped node with object value.
*/
public class UntypedObject extends UntypedNode {
/**
* The constructor for the UntypedObject
* @param propertiesMap The Map to create the node with
*/
public UntypedObject(@Nonnull Map<String, UntypedNode> propertiesMap) {
properties = new HashMap<>(propertiesMap);
}

private final Map<String, UntypedNode> properties;

/**
* Gets the value assigned to untyped node.
* @return The Map of property keys and their values.
*/
@Override
@Nonnull public Map<String, UntypedNode> getValue() {
return new HashMap<>(properties);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.microsoft.kiota.serialization;

import jakarta.annotation.Nonnull;

/**
* Represents an untyped node with string value.
*/
public class UntypedString extends UntypedNode {
/**
* The constructor for the UntypedObject
* @param stringValue The string to create the node with.
*/
public UntypedString(@Nonnull String stringValue) {
value = stringValue;
}

private final String value;

/**
* Gets the value assigned to untyped node.
* @return The string value of the node.
*/
@Override
@Nonnull public String getValue() {
return value;
}
}
1 change: 1 addition & 0 deletions components/serialization/json/spotBugsExcludeFilter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubu
<Class name="com.microsoft.kiota.serialization.mocks.UnionTypeMock" />
<Class name="com.microsoft.kiota.serialization.mocks.SecondTestEntity" />
<Class name="com.microsoft.kiota.serialization.mocks.TestEntity" />
<Class name="com.microsoft.kiota.serialization.mocks.UntypedTestEntity" />
</Or>
</Match>
<Match>
Expand Down
Loading

0 comments on commit f7eaaae

Please sign in to comment.