mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
fix type detection for client generation (#213)
This commit is contained in:
@@ -87,7 +87,7 @@ type Result struct {
|
|||||||
// The associated arabic text
|
// The associated arabic text
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
// The related translations to the text
|
// The related translations to the text
|
||||||
Translations []Interpretation `json:"translations"`
|
Translations []Translation `json:"translations"`
|
||||||
// The unique verse id across the Quran
|
// The unique verse id across the Quran
|
||||||
VerseId int32 `json:"verseId"`
|
VerseId int32 `json:"verseId"`
|
||||||
// The verse key e.g 1:1
|
// The verse key e.g 1:1
|
||||||
@@ -149,7 +149,7 @@ type Verse struct {
|
|||||||
// The unique id of the verse in the whole book
|
// The unique id of the verse in the whole book
|
||||||
Id int32 `json:"id"`
|
Id int32 `json:"id"`
|
||||||
// The interpretations of the verse
|
// The interpretations of the verse
|
||||||
Interpretations []Translation `json:"interpretations"`
|
Interpretations []Interpretation `json:"interpretations"`
|
||||||
// The key of this verse (chapter:verse) e.g 1:1
|
// The key of this verse (chapter:verse) e.g 1:1
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
// The verse number in this chapter
|
// The verse number in this chapter
|
||||||
@@ -161,7 +161,7 @@ type Verse struct {
|
|||||||
// The basic translation of the verse
|
// The basic translation of the verse
|
||||||
TranslatedText string `json:"translatedText"`
|
TranslatedText string `json:"translatedText"`
|
||||||
// The alternative translations for the verse
|
// The alternative translations for the verse
|
||||||
Translations []Interpretation `json:"translations"`
|
Translations []Translation `json:"translations"`
|
||||||
// The phonetic transliteration from arabic
|
// The phonetic transliteration from arabic
|
||||||
Transliteration string `json:"transliteration"`
|
Transliteration string `json:"transliteration"`
|
||||||
// The individual words within the verse (Ayah)
|
// The individual words within the verse (Ayah)
|
||||||
|
|||||||
@@ -60,5 +60,5 @@
|
|||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"version": "1.0.525"
|
"version": "1.0.526"
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ export interface Result {
|
|||||||
// The associated arabic text
|
// The associated arabic text
|
||||||
text?: string;
|
text?: string;
|
||||||
// The related translations to the text
|
// The related translations to the text
|
||||||
translations?: Interpretation[];
|
translations?: Translation[];
|
||||||
// The unique verse id across the Quran
|
// The unique verse id across the Quran
|
||||||
verseId?: number;
|
verseId?: number;
|
||||||
// The verse key e.g 1:1
|
// The verse key e.g 1:1
|
||||||
@@ -149,7 +149,7 @@ export interface Verse {
|
|||||||
// The unique id of the verse in the whole book
|
// The unique id of the verse in the whole book
|
||||||
id?: number;
|
id?: number;
|
||||||
// The interpretations of the verse
|
// The interpretations of the verse
|
||||||
interpretations?: Translation[];
|
interpretations?: Interpretation[];
|
||||||
// The key of this verse (chapter:verse) e.g 1:1
|
// The key of this verse (chapter:verse) e.g 1:1
|
||||||
key?: string;
|
key?: string;
|
||||||
// The verse number in this chapter
|
// The verse number in this chapter
|
||||||
@@ -161,7 +161,7 @@ export interface Verse {
|
|||||||
// The basic translation of the verse
|
// The basic translation of the verse
|
||||||
translatedText?: string;
|
translatedText?: string;
|
||||||
// The alternative translations for the verse
|
// The alternative translations for the verse
|
||||||
translations?: Interpretation[];
|
translations?: Translation[];
|
||||||
// The phonetic transliteration from arabic
|
// The phonetic transliteration from arabic
|
||||||
transliteration?: string;
|
transliteration?: string;
|
||||||
// The individual words within the verse (Ayah)
|
// The individual words within the verse (Ayah)
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ func main() {
|
|||||||
cmd.Dir = filepath.Join(tsPath, serviceName)
|
cmd.Dir = filepath.Join(tsPath, serviceName)
|
||||||
outp, err = cmd.CombinedOutput()
|
outp, err = cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(fmt.Sprintf("Problem formatting '%v' client: %v", serviceName, string(outp)))
|
fmt.Println(fmt.Sprintf("Problem formatting '%v' client: %v %s", serviceName, string(outp), err.Error()))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,8 +595,9 @@ func schemaToType(language, serviceName, typeName string, schemas map[string]*op
|
|||||||
detectType := func(currentType string, properties map[string]*openapi3.SchemaRef) (string, bool) {
|
detectType := func(currentType string, properties map[string]*openapi3.SchemaRef) (string, bool) {
|
||||||
index := map[string]bool{}
|
index := map[string]bool{}
|
||||||
for key, prop := range properties {
|
for key, prop := range properties {
|
||||||
index[key+prop.Value.Title] = true
|
index[key+prop.Value.Title+prop.Value.Description] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, schema := range schemas {
|
for k, schema := range schemas {
|
||||||
// we don't want to return the type matching itself
|
// we don't want to return the type matching itself
|
||||||
if strings.ToLower(k) == currentType {
|
if strings.ToLower(k) == currentType {
|
||||||
@@ -610,8 +611,7 @@ func schemaToType(language, serviceName, typeName string, schemas map[string]*op
|
|||||||
}
|
}
|
||||||
found := false
|
found := false
|
||||||
for key, prop := range schema.Value.Properties {
|
for key, prop := range schema.Value.Properties {
|
||||||
|
_, ok := index[key+prop.Value.Title+prop.Value.Description]
|
||||||
_, ok := index[key+prop.Value.Title]
|
|
||||||
found = ok
|
found = ok
|
||||||
if !ok {
|
if !ok {
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ func PublishAmessage() {
|
|||||||
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
|
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
rsp, err := streamService.Publish(&stream.PublishRequest{
|
rsp, err := streamService.Publish(&stream.PublishRequest{
|
||||||
Message: map[string]interface{}{
|
Message: map[string]interface{}{
|
||||||
"user": "john",
|
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"type": "signup",
|
"type": "signup",
|
||||||
|
"user": "john",
|
||||||
},
|
},
|
||||||
Topic: "events",
|
Topic: "events",
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user