MCPcopy Create free account
hub / github.com/goadesign/goa / Dup

Method Dup

http/codegen/openapi/json_schema.go:462–497  ·  view source on GitHub ↗

Dup creates a shallow clone of the given schema.

()

Source from the content-addressed store, hash-verified

460
461// Dup creates a shallow clone of the given schema.
462func (s *Schema) Dup() *Schema {
463 js := Schema{
464 ID: s.ID,
465 Description: s.Description,
466 Schema: s.Schema,
467 Type: s.Type,
468 DefaultValue: s.DefaultValue,
469 Title: s.Title,
470 Media: s.Media,
471 ReadOnly: s.ReadOnly,
472 PathStart: s.PathStart,
473 Links: s.Links,
474 Ref: s.Ref,
475 Enum: s.Enum,
476 Format: s.Format,
477 Pattern: s.Pattern,
478 Minimum: s.Minimum,
479 Maximum: s.Maximum,
480 MinLength: s.MinLength,
481 MaxLength: s.MaxLength,
482 MinItems: s.MinItems,
483 MaxItems: s.MaxItems,
484 Required: s.Required,
485 AdditionalProperties: s.AdditionalProperties,
486 }
487 for n, p := range s.Properties {
488 js.Properties[n] = p.Dup()
489 }
490 if s.Items != nil {
491 js.Items = s.Items.Dup()
492 }
493 for n, d := range s.Defs {
494 js.Defs[n] = d.Dup()
495 }
496 return &js
497}
498
499// buildAttributeSchema initializes the given JSON schema that corresponds to
500// the given attribute.

Callers

nothing calls this directly

Calls 1

DupMethod · 0.65

Tested by

no test coverage detected