@@ -56,7 +56,7 @@ func (g *gbnfGenerator) uniqueName(base string) string {
5656}
5757
5858func (g * gbnfGenerator ) String () string {
59- var lines []string
59+ lines := make ( []string , 0 , len ( g . ruleOrder ))
6060
6161 // Add common rules first
6262 g .addCommonRules ()
@@ -143,7 +143,7 @@ func (g *gbnfGenerator) generateObject(name string, s *jsonSchema) string {
143143 }
144144
145145 // Determine which properties to include
146- var props []string
146+ props := make ( []string , 0 , len ( s . Properties ))
147147 requiredSet := make (map [string ]bool )
148148 for _ , r := range s .Required {
149149 requiredSet [r ] = true
@@ -158,11 +158,9 @@ func (g *gbnfGenerator) generateObject(name string, s *jsonSchema) string {
158158
159159 // If additionalProperties is false, only include defined properties
160160 // For GBNF we always only include defined properties
161- for _ , propName := range propNames {
162- // For simplicity, include all defined properties
163- // (In a full implementation, we'd handle optional vs required differently)
164- props = append (props , propName )
165- }
161+ // For simplicity, include all defined properties
162+ // (In a full implementation, we'd handle optional vs required differently)
163+ props = append (props , propNames ... )
166164
167165 if len (props ) == 0 {
168166 return `"{" ws "}"`
0 commit comments