Skip to content

Commit 5ffa7ce

Browse files
authored
Fix/openapi generator source enum (#7)
* dev/openapi.yaml: Source returned back to Enum type * updated generated files
1 parent 30f4024 commit 5ffa7ce

23 files changed

+56
-56
lines changed

resources/dev-openai/.well-known/openapi.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ components:
6565
type: object
6666
properties:
6767
source:
68-
type: string
69-
# $ref: "#/components/schemas/Source"
68+
# type: string
69+
$ref: "#/components/schemas/Source"
7070
source_id:
7171
title: Source Id
7272
type: string
@@ -114,8 +114,8 @@ components:
114114
title: Document Id
115115
type: string
116116
source:
117-
type: string
118-
# $ref: "#/components/schemas/Source"
117+
# type: string
118+
$ref: "#/components/schemas/Source"
119119
source_id:
120120
title: Source Id
121121
type: string
@@ -260,8 +260,8 @@ components:
260260
type: object
261261
properties:
262262
source:
263-
type: string
264-
# $ref: "#/components/schemas/Source"
263+
# type: string
264+
$ref: "#/components/schemas/Source"
265265
source_id:
266266
type: string
267267
url:

src/datastore/factory.jl

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ global DATASTORE_MODULE = let
2323
end
2424
using Pkg
2525
function get_datastore()::Union{AbstractStorage,Nothing}
26+
@info string("Requested datastore: ", datastore_env())
2627
isnothing(DATASTORE_MODULE) && error("DATASTORE environment variable must be non empty and valid")
2728

2829
DATASTORE_MODULE.create_storage()
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.6.0
1+
7.0.0-SNAPSHOT

src/generated/docs/DocumentChunkMetadata.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Properties
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**source** | **String** | | [optional] [default to nothing]
7+
**source** | [***Source**](Source.md) | | [optional] [default to nothing]
88
**source_id** | **String** | | [optional] [default to nothing]
99
**url** | **String** | | [optional] [default to nothing]
1010
**created_at** | **String** | | [optional] [default to nothing]

src/generated/docs/DocumentMetadata.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Properties
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**source** | **String** | | [optional] [default to nothing]
7+
**source** | [***Source**](Source.md) | | [optional] [default to nothing]
88
**source_id** | **String** | | [optional] [default to nothing]
99
**url** | **String** | | [optional] [default to nothing]
1010
**created_at** | **String** | | [optional] [default to nothing]

src/generated/docs/DocumentMetadataFilter.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**document_id** | **String** | | [optional] [default to nothing]
8-
**source** | **String** | | [optional] [default to nothing]
8+
**source** | [***Source**](Source.md) | | [optional] [default to nothing]
99
**source_id** | **String** | | [optional] [default to nothing]
1010
**author** | **String** | | [optional] [default to nothing]
1111
**start_date** | **String** | | [optional] [default to nothing]

src/generated/src/models/model_Document.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""Document
6+
67
Document(;
78
id=nothing,
89
text=nothing,

src/generated/src/models/model_DocumentChunk.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""DocumentChunk
6+
67
DocumentChunk(;
78
id=nothing,
89
text=nothing,

src/generated/src/models/model_DocumentChunkMetadata.jl

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""DocumentChunkMetadata
6+
67
DocumentChunkMetadata(;
78
source=nothing,
89
source_id=nothing,
@@ -12,15 +13,15 @@
1213
document_id=nothing,
1314
)
1415
15-
- source::String
16+
- source::Source
1617
- source_id::String
1718
- url::String
1819
- created_at::String
1920
- author::String
2021
- document_id::String
2122
"""
2223
Base.@kwdef mutable struct DocumentChunkMetadata <: OpenAPI.APIModel
23-
source::Union{Nothing, String} = nothing
24+
source = nothing # spec type: Union{ Nothing, Source }
2425
source_id::Union{Nothing, String} = nothing
2526
url::Union{Nothing, String} = nothing
2627
created_at::Union{Nothing, String} = nothing
@@ -38,7 +39,7 @@ Base.@kwdef mutable struct DocumentChunkMetadata <: OpenAPI.APIModel
3839
end
3940
end # type DocumentChunkMetadata
4041

41-
const _property_types_DocumentChunkMetadata = Dict{Symbol,String}(Symbol("source")=>"String", Symbol("source_id")=>"String", Symbol("url")=>"String", Symbol("created_at")=>"String", Symbol("author")=>"String", Symbol("document_id")=>"String", )
42+
const _property_types_DocumentChunkMetadata = Dict{Symbol,String}(Symbol("source")=>"Source", Symbol("source_id")=>"String", Symbol("url")=>"String", Symbol("created_at")=>"String", Symbol("author")=>"String", Symbol("document_id")=>"String", )
4243
OpenAPI.property_type(::Type{ DocumentChunkMetadata }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_DocumentChunkMetadata[name]))}
4344

4445
function check_required(o::DocumentChunkMetadata)

src/generated/src/models/model_DocumentChunkWithScore.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""DocumentChunkWithScore
6+
67
DocumentChunkWithScore(;
78
id=nothing,
89
text=nothing,

src/generated/src/models/model_DocumentMetadata.jl

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""DocumentMetadata
6+
67
DocumentMetadata(;
78
source=nothing,
89
source_id=nothing,
@@ -11,14 +12,14 @@
1112
author=nothing,
1213
)
1314
14-
- source::String
15+
- source::Source
1516
- source_id::String
1617
- url::String
1718
- created_at::String
1819
- author::String
1920
"""
2021
Base.@kwdef mutable struct DocumentMetadata <: OpenAPI.APIModel
21-
source::Union{Nothing, String} = nothing
22+
source = nothing # spec type: Union{ Nothing, Source }
2223
source_id::Union{Nothing, String} = nothing
2324
url::Union{Nothing, String} = nothing
2425
created_at::Union{Nothing, String} = nothing
@@ -34,7 +35,7 @@ Base.@kwdef mutable struct DocumentMetadata <: OpenAPI.APIModel
3435
end
3536
end # type DocumentMetadata
3637

37-
const _property_types_DocumentMetadata = Dict{Symbol,String}(Symbol("source")=>"String", Symbol("source_id")=>"String", Symbol("url")=>"String", Symbol("created_at")=>"String", Symbol("author")=>"String", )
38+
const _property_types_DocumentMetadata = Dict{Symbol,String}(Symbol("source")=>"Source", Symbol("source_id")=>"String", Symbol("url")=>"String", Symbol("created_at")=>"String", Symbol("author")=>"String", )
3839
OpenAPI.property_type(::Type{ DocumentMetadata }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_DocumentMetadata[name]))}
3940

4041
function check_required(o::DocumentMetadata)

src/generated/src/models/model_DocumentMetadataFilter.jl

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""DocumentMetadataFilter
6+
67
DocumentMetadataFilter(;
78
document_id=nothing,
89
source=nothing,
@@ -13,15 +14,15 @@
1314
)
1415
1516
- document_id::String
16-
- source::String
17+
- source::Source
1718
- source_id::String
1819
- author::String
1920
- start_date::String
2021
- end_date::String
2122
"""
2223
Base.@kwdef mutable struct DocumentMetadataFilter <: OpenAPI.APIModel
2324
document_id::Union{Nothing, String} = nothing
24-
source::Union{Nothing, String} = nothing
25+
source = nothing # spec type: Union{ Nothing, Source }
2526
source_id::Union{Nothing, String} = nothing
2627
author::Union{Nothing, String} = nothing
2728
start_date::Union{Nothing, String} = nothing
@@ -38,7 +39,7 @@ Base.@kwdef mutable struct DocumentMetadataFilter <: OpenAPI.APIModel
3839
end
3940
end # type DocumentMetadataFilter
4041

41-
const _property_types_DocumentMetadataFilter = Dict{Symbol,String}(Symbol("document_id")=>"String", Symbol("source")=>"String", Symbol("source_id")=>"String", Symbol("author")=>"String", Symbol("start_date")=>"String", Symbol("end_date")=>"String", )
42+
const _property_types_DocumentMetadataFilter = Dict{Symbol,String}(Symbol("document_id")=>"String", Symbol("source")=>"Source", Symbol("source_id")=>"String", Symbol("author")=>"String", Symbol("start_date")=>"String", Symbol("end_date")=>"String", )
4243
OpenAPI.property_type(::Type{ DocumentMetadataFilter }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_DocumentMetadataFilter[name]))}
4344

4445
function check_required(o::DocumentMetadataFilter)

src/generated/src/models/model_HTTPValidationError.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""HTTPValidationError
6+
67
HTTPValidationError(;
78
detail=nothing,
89
)

src/generated/src/models/model_LocationInner.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44

55

6-
@doc raw"""
6+
@doc raw"""Location_inner
7+
78
LocationInner(; value=nothing)
89
"""
910
mutable struct LocationInner <: OpenAPI.AnyOfAPIModel

src/generated/src/models/model_Query.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""Query
6+
67
Query(;
78
query=nothing,
89
filter=nothing,

src/generated/src/models/model_QueryRequest.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""QueryRequest
6+
67
QueryRequest(;
78
queries=nothing,
89
)

src/generated/src/models/model_QueryResponse.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""QueryResponse
6+
67
QueryResponse(;
78
results=nothing,
89
)

src/generated/src/models/model_QueryResult.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""QueryResult
6+
67
QueryResult(;
78
query=nothing,
89
results=nothing,

src/generated/src/models/model_QueryWithEmbedding.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""QueryWithEmbedding
6+
67
QueryWithEmbedding(;
78
query=nothing,
89
filter=nothing,

src/generated/src/models/model_Source.jl

+4-21
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""An enumeration.
6-
7-
Source(;
8-
)
9-
10-
"""
11-
Base.@kwdef mutable struct Source <: OpenAPI.APIModel
12-
13-
function Source()
14-
return new()
15-
end
16-
end # type Source
17-
18-
const _property_types_Source = Dict{Symbol,String}()
19-
OpenAPI.property_type(::Type{ Source }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_Source[name]))}
20-
21-
function check_required(o::Source)
22-
true
23-
end
24-
25-
function OpenAPI.validate_property(::Type{ Source }, name::Symbol, val)
5+
if !isdefined(@__MODULE__, :Source)
6+
const Source = String
7+
else
8+
@warn("Skipping redefinition of Source to String")
269
end

src/generated/src/models/model_UpsertRequest.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""UpsertRequest
6+
67
UpsertRequest(;
78
documents=nothing,
89
)

src/generated/src/models/model_UpsertResponse.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""UpsertResponse
6+
67
UpsertResponse(;
78
ids=nothing,
89
)

src/generated/src/models/model_ValidationError.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Do not modify this file directly. Modify the OpenAPI specification instead.
33

44

5-
@doc raw"""
5+
@doc raw"""ValidationError
6+
67
ValidationError(;
78
loc=nothing,
89
msg=nothing,

0 commit comments

Comments
 (0)