Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLindhout committed Dec 24, 2021
1 parent 7f106a2 commit b341a78
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions convert_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,25 +530,26 @@ func enhanceModelsWithFields(enums []*Enum, schema *ast.Schema, cfg *config.Conf

enum := findEnum(enums, shortType)
field := &Field{
Name: name,
JSONName: jsonName,
Type: shortType,
TypeWithoutPointer: strings.Replace(strings.TrimPrefix(shortType, "*"), ".", "Dot", -1),
BoilerField: boilerField,
IsNumberID: isNumberID,
IsPrimaryID: isPrimaryID,
IsPrimaryNumberID: isPrimaryNumberID,
IsPrimaryStringID: isPrimaryStringID,
IsRelation: boilerField.IsRelation,
IsRelationAndNotForeignKey: boilerField.IsRelation && !boilerField.IsForeignKey,
IsObject: isObject,
IsOr: strings.EqualFold(name, "or"),
IsAnd: strings.EqualFold(name, "and"),
IsPlural: IsPlural(name),
PluralName: Plural(name),
OriginalType: typ,
Description: field.Description,
Enum: enum,
Name: name,
JSONName: jsonName,
Type: shortType,
TypeWithoutPointer: strings.Replace(strings.TrimPrefix(shortType, "*"), ".", "Dot", -1),
BoilerField: boilerField,
IsNumberID: isNumberID,
IsPrimaryID: isPrimaryID,
IsPrimaryNumberID: isPrimaryNumberID,
IsPrimaryStringID: isPrimaryStringID,
IsRelation: boilerField.IsRelation,
IsRelationAndNotForeignKey: boilerField.IsRelation &&
!strings.HasSuffix(strings.ToLower(name), "id"),
IsObject: isObject,
IsOr: strings.EqualFold(name, "or"),
IsAnd: strings.EqualFold(name, "and"),
IsPlural: IsPlural(name),
PluralName: Plural(name),
OriginalType: typ,
Description: field.Description,
Enum: enum,
}
field.ConvertConfig = getConvertConfig(enums, m, field)
m.Fields = append(m.Fields, field)
Expand Down

0 comments on commit b341a78

Please sign in to comment.