-
Notifications
You must be signed in to change notification settings - Fork 21
chore(all): factor the version into clients.config.json #496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
package com.algolia.codegen; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.google.common.collect.Sets; | ||
import io.swagger.v3.core.util.Json; | ||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.util.*; | ||
import org.openapitools.codegen.CodegenOperation; | ||
|
@@ -149,4 +153,18 @@ public static void generateServer( | |
System.exit(1); | ||
} | ||
} | ||
|
||
// doens't work for javascript | ||
public static String getPackageVersion(String language) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's throw an error when |
||
try { | ||
JsonNode config = Json | ||
.mapper() | ||
.readTree(new File("config/clients.config.json")); | ||
return config.get(language).get("packageVersion").asText(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
System.exit(1); | ||
} | ||
return null; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import clientsConfig from '../config/clients.config.json'; | ||
import openapiConfig from '../config/openapitools.json'; | ||
|
||
import type { Language } from './types'; | ||
|
||
|
@@ -25,3 +26,11 @@ export function getTestOutputFolder(language: Language): string { | |
export function getCustomGenerator(language: Language): string { | ||
return clientsConfig[language].customGenerator; | ||
} | ||
|
||
export function getPackageVersionDefault(language: Language): string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a description with the case for js pls? |
||
if (language === 'javascript') { | ||
return openapiConfig['generator-cli'].generators['javascript-search'] | ||
.additionalProperties.packageVersion; | ||
} | ||
return clientsConfig[language].packageVersion; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.