-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate types for inline serializers, exclude them from the index
closes #19
- Loading branch information
Showing
12 changed files
with
60 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
playground/vanilla/app/frontend/types/serializers/ComposerWithSongs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
// TypesFromSerializers CacheKey 1e3a5dea8847b2dcfe76fec134589cbb | ||
// TypesFromSerializers CacheKey 9111c6d881174b0013582fa6366868db | ||
// | ||
// DO NOT MODIFY: This file was automatically generated by TypesFromSerializers. | ||
import type Model from './Model' | ||
import type ComposerWithSongsSong from './ComposerWithSongs/Song' | ||
|
||
export default interface ComposerWithSongs { | ||
id: number | ||
firstName?: string | ||
lastName?: string | ||
name: string | ||
songs: Model[] | ||
songs: ComposerWithSongsSong[] | ||
} |
8 changes: 8 additions & 0 deletions
8
playground/vanilla/app/frontend/types/serializers/ComposerWithSongs/Song.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// TypesFromSerializers CacheKey a69c0dbcc904740e5de89181ef4b2837 | ||
// | ||
// DO NOT MODIFY: This file was automatically generated by TypesFromSerializers. | ||
|
||
export default interface ComposerWithSongsSong { | ||
id: number | ||
title?: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
// TypesFromSerializers CacheKey 460b4a83a2e81c9d693ac5490f9e0b76 | ||
// TypesFromSerializers CacheKey f4f9e398dc092747d13607e2bdcb0846 | ||
// | ||
// DO NOT MODIFY: This file was automatically generated by TypesFromSerializers. | ||
import type Composer from './Composer' | ||
|
||
export default interface Song { | ||
id: number | ||
composer: Composer | ||
genre: "disco" | "rock" | "classical" | ||
genre: "fingerstyle" | "rock" | "classical" | ||
tempo: "slow" | "medium" | "fast" | ||
title?: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
playground/vanilla/app/serializers/composer_with_songs_serializer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
class ComposerWithSongsSerializer < ComposerSerializer | ||
has_many :songs, serializer: ModelSerializer | ||
class SongSerializer < BaseSerializer | ||
attributes(:id, :title) | ||
end | ||
|
||
has_many :songs, serializer: SongSerializer | ||
end |
6 changes: 3 additions & 3 deletions
6
spec/types_from_serializers/__snapshots__/interfaces_ComposerWithSongsSerializer.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
// TypesFromSerializers CacheKey 1e3a5dea8847b2dcfe76fec134589cbb | ||
// TypesFromSerializers CacheKey 9111c6d881174b0013582fa6366868db | ||
// | ||
// DO NOT MODIFY: This file was automatically generated by TypesFromSerializers. | ||
import type Model from './Model' | ||
import type ComposerWithSongsSong from './ComposerWithSongs/Song' | ||
|
||
export default interface ComposerWithSongs { | ||
id: number | ||
firstName?: string | ||
lastName?: string | ||
name: string | ||
songs: Model[] | ||
songs: ComposerWithSongsSong[] | ||
} |
8 changes: 8 additions & 0 deletions
8
...rom_serializers/__snapshots__/interfaces_ComposerWithSongsSerializer__SongSerializer.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// TypesFromSerializers CacheKey a69c0dbcc904740e5de89181ef4b2837 | ||
// | ||
// DO NOT MODIFY: This file was automatically generated by TypesFromSerializers. | ||
|
||
export default interface ComposerWithSongsSong { | ||
id: number | ||
title?: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...izers/__snapshots__/namespace_interfaces_ComposerWithSongsSerializer__SongSerializer.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// TypesFromSerializers CacheKey a69c0dbcc904740e5de89181ef4b2837 | ||
// | ||
// DO NOT MODIFY: This file was automatically generated by TypesFromSerializers. | ||
export {} | ||
|
||
declare global { | ||
namespace Schema { | ||
interface ComposerWithSongsSong { | ||
id: number | ||
title?: string | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters