Skip to content

Commit

Permalink
Merge pull request #166 from MicrosoftDocs/main
Browse files Browse the repository at this point in the history
Merge main to live
  • Loading branch information
baywet authored Oct 11, 2024
2 parents e09a17f + 99eaded commit c3311f7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions OpenAPI/kiota/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,32 @@ const deserializedUser = deserializeFromJson(result, createUserFromDiscriminator

---

## Types mapping

The table below describes the mapping between [OpenAPI type-format pairs](https://spec.openapis.org/registry/format/) and language types. Any format which does not have an entry in the table will use the default type for the corresponding OpenAPI type.

| OpenAPI type | OpenAPI format | C# Type | Go Type | Java Type | TypeScript Type | PHP Type | Python Type | Default Mapping for OpenAPI Type |
| ------------ | -------------- | ------- | ------- | --------- | --------------- | -------- | ----------- | ------- |
| number | [uint8](https://spec.openapis.org/registry/format/uint8.html) | [sbyte](/dotnet/api/system.sbyte) | [int8](https://pkg.go.dev/builtin#int8) | [Short](https://docs.oracle.com/javase/8/docs/api/java/lang/Short.html) | [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | [int](https://www.php.net/manual/en/language.types.integer.php) | [int](https://docs.python.org/3/library/functions.html#int) | |
| number | [int8](https://spec.openapis.org/registry/format/int8.html) | [byte](/dotnet/api/system.byte) | [int8](https://pkg.go.dev/builtin#int8) | [Byte](https://docs.oracle.com/javase/8/docs/api/java/lang/Short.html) | [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | [int](https://www.php.net/manual/en/language.types.integer.php) | [int](https://docs.python.org/3/library/functions.html#int) | |
| number | [int32](https://spec.openapis.org/registry/format/int32.html) | [int32/int](/dotnet/api/system.int32) | [int32](https://pkg.go.dev/builtin#int32) | [Integer](https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html) | [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | [int](https://www.php.net/manual/en/language.types.integer.php) | [int](https://docs.python.org/3/library/functions.html#int) | |
| number | [int64](https://spec.openapis.org/registry/format/int64.html) | [int64/long](/dotnet/api/system.int32) | [int64](https://pkg.go.dev/builtin#int64) | [Long](https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html) | [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | [int](https://www.php.net/manual/en/language.types.integer.php) | [int](https://docs.python.org/3/library/functions.html#int) | |
| number | [float](https://spec.openapis.org/registry/format/float.html) | [float/single](/dotnet/api/system.single) | [float32](https://pkg.go.dev/builtin#float32) | [Float](https://docs.oracle.com/javase/8/docs/api/java/lang/Float.html) | [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | [float](https://www.php.net/manual/en/language.types.float.php) | [float](https://docs.python.org/3/library/functions.html#float) | |
| number | [double](https://spec.openapis.org/registry/format/double.html) | [double](/dotnet/api/system.double) | [float64](https://pkg.go.dev/builtin#float64) | [Double](https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html) | [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | [float](https://www.php.net/manual/en/language.types.float.php) | [float](https://docs.python.org/3/library/functions.html#float) | Yes |
| number | [decimal](https://spec.openapis.org/registry/format/decimal.html) | [decimal](/dotnet/api/system.decimal) | [float64](https://pkg.go.dev/builtin#float64) | [BigDecimal](https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html) | [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | [float](https://www.php.net/manual/en/language.types.float.php) | [float](https://docs.python.org/3/library/functions.html#float) | |
| string | N/A | [string](/dotnet/api/system.string) | [string](https://pkg.go.dev/builtin#string) | [String](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html) | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) | [string](https://www.php.net/manual/en/language.types.string.php) | [string](https://docs.python.org/3/library/string.html) | Yes |
| string | [uuid](https://spec.openapis.org/registry/format/uuid.html) | [Guid](/dotnet/api/system.guid) | [UUID](https://pkg.go.dev/github.com/google/uuid#UUID) | [UUID](https://docs.oracle.com/javase/8/docs/api/java/util/UUID.html) | [Guid](https://www.npmjs.com/package/guid-typescript) | [string](https://www.php.net/manual/en/language.types.string.php) | [UUID](https://docs.python.org/3/library/uuid.html) | |
| string | [date-time](https://spec.openapis.org/registry/format/date-time.html) | [DateTimeOffset](/dotnet/api/system.datetimeoffset) | [time](https://pkg.go.dev/time#Time) | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | [DateTime](https://www.php.net/manual/en/class.datetime.php) | [datetime](https://docs.python.org/3/library/datetime.html) | |
| string | [date](https://spec.openapis.org/registry/format/date.html) | [Kiota Date](https://github.com/microsoft/kiota-dotnet/blob/main/src/abstractions/Date.cs) | [Kiota Date Only](https://github.com/microsoft/kiota-abstractions-go/blob/main/serialization/date_only.go) | [LocalDate](https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html) | [Kiota Date Only](https://github.com/microsoft/kiota-typescript/blob/main/packages/abstractions/src/dateOnly.ts) | [Kiota Date](https://github.com/microsoft/kiota-abstractions-php/blob/main/src/Types/Date.php) | [date](https://docs.python.org/3/library/datetime.html) | |
| string | [time](https://spec.openapis.org/registry/format/time.html) | [Kiota Time](https://github.com/microsoft/kiota-dotnet/blob/main/src/abstractions/Time.cs) | [Kiota Time Only](https://github.com/microsoft/kiota-abstractions-go/blob/main/serialization/time_only.go) | [LocalTime](https://docs.oracle.com/javase/8/docs/api/java/time/LocalTime.html) | [Kiota Time Only](https://github.com/microsoft/kiota-typescript/blob/main/packages/abstractions/src/timeOnly.ts) | [Kiota Time](https://github.com/microsoft/kiota-abstractions-php/blob/main/src/Types/Time.php) | [time](https://docs.python.org/3/library/datetime.html) | |
| string | [duration](https://spec.openapis.org/registry/format/duration.html) | [TimeSpan](/dotnet/api/system.timespan) | [Kiota ISO Duration](https://github.com/microsoft/kiota-abstractions-go/blob/main/serialization/iso_duration.go) | [Kiota PeriodAndDuration](https://github.com/microsoft/kiota-java/blob/main/components/abstractions/src/main/java/com/microsoft/kiota/PeriodAndDuration.java) | [Kiota Duration](https://github.com/microsoft/kiota-typescript/blob/main/packages/abstractions/src/duration.ts) | [DateInterval](https://www.php.net/manual/en/class.dateinterval.php) | [timedelta](https://docs.python.org/3/library/datetime.html) | |
| string | [binary](https://spec.openapis.org/registry/format/binary.html) | [Stream](/dotnet/api/system.io.stream) | byte[] | byte[] | [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) | [StreamInterface](https://github.com/php-fig/http-message/blob/master/src/StreamInterface.php) | bytes | |
| string | [base64url](https://spec.openapis.org/registry/format/base64url.html) | byte[] | byte[] | byte[] | [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) | [StreamInterface](https://github.com/php-fig/http-message/blob/master/src/StreamInterface.php) | bytes | |
| bool | N/A | [bool](/dotnet/api/system.boolean) | [bool](https://pkg.go.dev/builtin#bool) | [Boolean](https://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html) | [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | [bool](https://www.php.net/manual/en/language.types.boolean.php) | [bool](https://docs.python.org/3/library/functions.html#bool) | |

> [!NOTE]
> The C# Date and Time types also provide operators so they are fully convertible from or to [DateOnly](/dotnet/api/system.dateonly) and [TimeOnly](/dotnet/api/system.timeonly).
## Untyped Node

In scenarios where the type information for a property/parameter in the input OpenAPI description is not present, Kiota will generate with the generic `UntypedNode` type which represent that the property/parameter could be a primitive,object or a collection. As the type information is unknown at compile/generation time, the `UntypedNode` object can be parsed at runtime by calling the `GetValue()` methods of the derived types to get the native representation of the node.
Expand Down
2 changes: 1 addition & 1 deletion OpenAPI/kiota/tutorials/python-azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ In this tutorial, you generate an API client that uses [Microsoft identity authe

## Required tools

- [Python 3.6+](https://www.python.org/)
- [Python 3.8+](https://www.python.org/)
- [pip 20.0+](https://pip.pypa.io/en/stable/)
- [asyncio](https://docs.python.org/3/library/asyncio.html) or any other supported async environment, for example, AnyIO, Trio.

Expand Down

0 comments on commit c3311f7

Please sign in to comment.