diff --git a/package-lock.json b/package-lock.json index b2d2875..85f28cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -112,18 +112,19 @@ } }, "@ovotech/avro-kafkajs": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@ovotech/avro-kafkajs/-/avro-kafkajs-0.3.0.tgz", - "integrity": "sha1-OUVstYaRZbvYMkf4I/QjN54cbvc=", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@ovotech/avro-kafkajs/-/avro-kafkajs-0.6.3.tgz", + "integrity": "sha1-1QGVUBP4tErAr9lWJ6ygnKNMExM=", "requires": { - "@ovotech/schema-registry-api": "^1.0.5", - "avsc": "^5.4.21" + "@ovotech/schema-registry-api": "^1.1.1", + "avsc": "^5.5.6", + "long": "^4.0.0" } }, "@ovotech/schema-registry-api": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@ovotech/schema-registry-api/-/schema-registry-api-1.0.7.tgz", - "integrity": "sha1-tvbg0LeqED5Ac5CoLsj168RtoVY=", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@ovotech/schema-registry-api/-/schema-registry-api-1.1.1.tgz", + "integrity": "sha1-jVQ5EWeu0y/293empCMuLiiBSO8=", "requires": { "node-fetch": "^2.6.0" } diff --git a/package.json b/package.json index 016300c..5e96b62 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@material-ui/core": "^4.11.3", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "^4.0.0-alpha.56", - "@ovotech/avro-kafkajs": "^0.3.0", + "@ovotech/avro-kafkajs": "^0.6.3", "@types/long": "^4.0.1", "ag-grid-community": "^23.2.0", "ag-grid-react": "^23.2.0", diff --git a/src/client/schema-registry/versions.tsx b/src/client/schema-registry/versions.tsx index e6cbec4..b37dbe2 100644 --- a/src/client/schema-registry/versions.tsx +++ b/src/client/schema-registry/versions.tsx @@ -38,7 +38,8 @@ interface RecordType { type Version = { version: number, - schema?: GetSchemaResult, + schema?: Schema, + schemaID?: number, [key: string]: any, } @@ -92,8 +93,9 @@ export class Versions extends React.Component { app.get("/api/schema-registry/schema/:subject/:version", async (req, res) => { try { - const schema: GetSchemaResult = await schemaRegistry.getSubjectVersionSchema(req.params.subject, parseInt(req.params.version)) - res.status(200).json(schema) + const schemaVersion: SchemaVersion = await schemaRegistry.getSubjectVersion(req.params.subject, parseInt(req.params.version)) + const schema: Schema = JSON.parse(schemaVersion.schema) + const out: GetSchemaResult = { schema, id: schemaVersion.id } + res.status(200).json(out) } catch (error) { res.status(500).json({ error: error.toString() }) diff --git a/src/shared/api.ts b/src/shared/api.ts index 515bdaf..a653707 100644 --- a/src/shared/api.ts +++ b/src/shared/api.ts @@ -22,7 +22,7 @@ export type GetTopicMessagesResult = MaybeError & TopicMessages export type GetSubjectsResult = MaybeError & string[] export type GetSubjectVersionsResult = MaybeError & number[] -export type GetSchemaResult = MaybeError & Schema +export type GetSchemaResult = MaybeError & { schema: Schema, id: number } export type ConnectorState = `RUNNING` | `FAILED` | `PAUSED` export type ConnectorConfig = { [key: string]: string }