Skip to content

Commit

Permalink
Add more tests covering intersectionType
Browse files Browse the repository at this point in the history
Add more tests and fix printer module indentation
  • Loading branch information
MangelMaxime committed Mar 24, 2024
1 parent 30b0343 commit a2320ae
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* String enums starting with a number should be escaped with backtick ([GH-43](https://github.com/glutinum-org/cli/issues/43))
* Optional interface properties should be transform into `'T option`
* Don't indent module name when printing the F# code
* When leaving `module` scope, indent the printer memory

### Added

Expand Down
1 change: 1 addition & 0 deletions src/Glutinum.Converter/Printer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ let rec print (printer: Printer) (fsharpTypes: FSharpType list) =

printer.Indent
print printer moduleInfo.Types
printer.Unindent

// TODO: Make print return the tail
// Allowing module to eat they content and be able to unindent?
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
interface ErrorHandling {
success: boolean;
error?: string;
}

interface ArtworksData {
artworks: string[];
}

interface Pagination {
page: number;
pageSize: number;
}

type ArtworksResponse = ArtworksData & ErrorHandling;
type PaginationArtworksResponse = ArtworksResponse & Pagination;
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module rec Glutinum

open Fable.Core
open System

[<AllowNullLiteral>]
type ErrorHandling =
abstract member success: bool with get, set
abstract member error: string option with get, set

[<AllowNullLiteral>]
type ArtworksData =
abstract member artworks: ResizeArray<string> with get, set

[<AllowNullLiteral>]
type Pagination =
abstract member page: float with get, set
abstract member pageSize: float with get, set

[<AllowNullLiteral>]
type ArtworksResponse =
abstract member artworks: ResizeArray<string> with get, set
abstract member success: bool with get, set
abstract member error: string option with get, set

[<AllowNullLiteral>]
type PaginationArtworksResponse =
abstract member artworks: ResizeArray<string> with get, set
abstract member success: bool with get, set
abstract member error: string option with get, set
abstract member page: float with get, set
abstract member pageSize: float with get, set

(***)
#r "nuget: Fable.Core"
(***)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interface CreateArtistBioBase {
artistID: string;
thirdParty?: boolean;
}

type CreateArtistBioRequest = CreateArtistBioBase & { html: string };
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module rec Glutinum

open Fable.Core
open System

[<AllowNullLiteral>]
type CreateArtistBioBase =
abstract member artistID: string with get, set
abstract member thirdParty: bool option with get, set

[<AllowNullLiteral>]
type CreateArtistBioRequest =
abstract member artistID: string with get, set
abstract member thirdParty: bool option with get, set
abstract member html: string with get, set

(***)
#r "nuget: Fable.Core"
(***)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
interface CreateArtistBioBase {
artistID: string;
thirdParty?: boolean;
}

interface Pagination {
page: number;
pageSize: number;
}

type CreateArtistBioRequest =
CreateArtistBioBase
& { html: string }
& { markdown: string }
& Pagination;
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module rec Glutinum

open Fable.Core
open System

[<AllowNullLiteral>]
type CreateArtistBioBase =
abstract member artistID: string with get, set
abstract member thirdParty: bool option with get, set

[<AllowNullLiteral>]
type Pagination =
abstract member page: float with get, set
abstract member pageSize: float with get, set

[<AllowNullLiteral>]
type CreateArtistBioRequest =
abstract member artistID: string with get, set
abstract member thirdParty: bool option with get, set
abstract member html: string with get, set
abstract member markdown: string with get, set
abstract member page: float with get, set
abstract member pageSize: float with get, set

(***)
#r "nuget: Fable.Core"
(***)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
interface ArtworksData {
artworks: string[];
}

namespace Error {
export interface ErrorHandling {
success: boolean;
error?: string;
}
}

type ArtworksResponse = ArtworksData & Error.ErrorHandling;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module rec Glutinum

open Fable.Core
open System

[<AllowNullLiteral>]
type ArtworksData =
abstract member artworks: ResizeArray<string> with get, set

module Error =

[<AllowNullLiteral>]
type ErrorHandling =
abstract member success: bool with get, set
abstract member error: string option with get, set

[<AllowNullLiteral>]
type ArtworksResponse =
abstract member artworks: ResizeArray<string> with get, set
abstract member success: bool with get, set
abstract member error: string option with get, set

(***)
#r "nuget: Fable.Core"
(***)

0 comments on commit a2320ae

Please sign in to comment.