mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 04:20:24 +00:00
Refactoring core structure of datamodel to accomodate v2 model.
There is a lot of overlap on these models, to create a much more sensible design, a new 'base' package has been added which contains shared models that both versions make use of.
This commit is contained in:
25
datamodel/low/base/external_doc.go
Normal file
25
datamodel/low/base/external_doc.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package base
|
||||
|
||||
import (
|
||||
"github.com/pb33f/libopenapi/datamodel/low"
|
||||
"github.com/pb33f/libopenapi/index"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type ExternalDoc struct {
|
||||
Description low.NodeReference[string]
|
||||
URL low.NodeReference[string]
|
||||
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
||||
}
|
||||
|
||||
func (ex *ExternalDoc) FindExtension(ext string) *low.ValueReference[any] {
|
||||
return low.FindItemInMap[any](ext, ex.Extensions)
|
||||
}
|
||||
|
||||
func (ex *ExternalDoc) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
||||
ex.Extensions = low.ExtractExtensions(root)
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user