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
|
||||
Text string `json:"text"`
|
||||
// The related translations to the text
|
||||
Translations []Interpretation `json:"translations"`
|
||||
Translations []Translation `json:"translations"`
|
||||
// The unique verse id across the Quran
|
||||
VerseId int32 `json:"verseId"`
|
||||
// The verse key e.g 1:1
|
||||
@@ -149,7 +149,7 @@ type Verse struct {
|
||||
// The unique id of the verse in the whole book
|
||||
Id int32 `json:"id"`
|
||||
// The interpretations of the verse
|
||||
Interpretations []Translation `json:"interpretations"`
|
||||
Interpretations []Interpretation `json:"interpretations"`
|
||||
// The key of this verse (chapter:verse) e.g 1:1
|
||||
Key string `json:"key"`
|
||||
// The verse number in this chapter
|
||||
@@ -161,7 +161,7 @@ type Verse struct {
|
||||
// The basic translation of the verse
|
||||
TranslatedText string `json:"translatedText"`
|
||||
// The alternative translations for the verse
|
||||
Translations []Interpretation `json:"translations"`
|
||||
Translations []Translation `json:"translations"`
|
||||
// The phonetic transliteration from arabic
|
||||
Transliteration string `json:"transliteration"`
|
||||
// The individual words within the verse (Ayah)
|
||||
|
||||
@@ -60,5 +60,5 @@
|
||||
},
|
||||
"type": "module",
|
||||
"types": "dist/index.d.ts",
|
||||
"version": "1.0.525"
|
||||
"version": "1.0.526"
|
||||
}
|
||||
@@ -87,7 +87,7 @@ export interface Result {
|
||||
// The associated arabic text
|
||||
text?: string;
|
||||
// The related translations to the text
|
||||
translations?: Interpretation[];
|
||||
translations?: Translation[];
|
||||
// The unique verse id across the Quran
|
||||
verseId?: number;
|
||||
// The verse key e.g 1:1
|
||||
@@ -149,7 +149,7 @@ export interface Verse {
|
||||
// The unique id of the verse in the whole book
|
||||
id?: number;
|
||||
// The interpretations of the verse
|
||||
interpretations?: Translation[];
|
||||
interpretations?: Interpretation[];
|
||||
// The key of this verse (chapter:verse) e.g 1:1
|
||||
key?: string;
|
||||
// The verse number in this chapter
|
||||
@@ -161,7 +161,7 @@ export interface Verse {
|
||||
// The basic translation of the verse
|
||||
translatedText?: string;
|
||||
// The alternative translations for the verse
|
||||
translations?: Interpretation[];
|
||||
translations?: Translation[];
|
||||
// The phonetic transliteration from arabic
|
||||
transliteration?: string;
|
||||
// The individual words within the verse (Ayah)
|
||||
|
||||
@@ -201,7 +201,7 @@ func main() {
|
||||
cmd.Dir = filepath.Join(tsPath, serviceName)
|
||||
outp, err = cmd.CombinedOutput()
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
index := map[string]bool{}
|
||||
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 {
|
||||
// we don't want to return the type matching itself
|
||||
if strings.ToLower(k) == currentType {
|
||||
@@ -610,8 +611,7 @@ func schemaToType(language, serviceName, typeName string, schemas map[string]*op
|
||||
}
|
||||
found := false
|
||||
for key, prop := range schema.Value.Properties {
|
||||
|
||||
_, ok := index[key+prop.Value.Title]
|
||||
_, ok := index[key+prop.Value.Title+prop.Value.Description]
|
||||
found = ok
|
||||
if !ok {
|
||||
break
|
||||
|
||||
@@ -11,9 +11,9 @@ func PublishAmessage() {
|
||||
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := streamService.Publish(&stream.PublishRequest{
|
||||
Message: map[string]interface{}{
|
||||
"user": "john",
|
||||
"id": "1",
|
||||
"type": "signup",
|
||||
"user": "john",
|
||||
},
|
||||
Topic: "events",
|
||||
})
|
||||
|
||||
@@ -17,7 +17,7 @@ message Chapter {
|
||||
// The number of verses in the chapter
|
||||
int32 verses = 2;
|
||||
// The simple name of the chapter
|
||||
string name = 3;
|
||||
string name = 3;
|
||||
// The arabic name of the chapter
|
||||
string arabic_name = 4;
|
||||
// The complex name of the chapter
|
||||
|
||||
Reference in New Issue
Block a user