@GET @Path("/schemas/ids/{id}") @ApiOperation(value = "Get schema version by id", response = Schema.class, tags = OPERATION_GROUP_CONFLUENT_SR) @Timed @UnitOfWork public Response getSchemaById(@ApiParam(value = "schema version id", required = true) @PathParam("id") Long id) { Response response; try { SchemaVersionInfo schemaVersionInfo = schemaRegistry.getSchemaVersionInfo(new SchemaIdVersion(id)); SchemaString schema = new SchemaString(); schema.setSchema(schemaVersionInfo.getSchemaText()); response = WSUtils.respondEntity(schema, Response.Status.OK); } catch (SchemaNotFoundException ex) { LOG.error("No schema version found with id [{}]", id, ex); response = schemaNotFoundError(); } catch (Exception ex) { LOG.error("Encountered error while retrieving Schema with id: [{}]", id, ex); response = serverError(); } return response; }
@GET @Path("/schemas/ids/{id}") @ApiOperation(value = "Get schema version by id", response = Schema.class, tags = OPERATION_GROUP_CONFLUENT_SR) @Timed @UnitOfWork public Response getSchemaById(@ApiParam(value = "schema version id", required = true) @PathParam("id") Long id) { Response response; try { SchemaVersionInfo schemaVersionInfo = schemaRegistry.getSchemaVersionInfo(new SchemaIdVersion(id)); SchemaString schema = new SchemaString(); schema.setSchema(schemaVersionInfo.getSchemaText()); response = WSUtils.respondEntity(schema, Response.Status.OK); } catch (SchemaNotFoundException ex) { LOG.error("No schema version found with id [{}]", id, ex); response = schemaNotFoundError(); } catch (Exception ex) { LOG.error("Encountered error while retrieving Schema with id: [{}]", id, ex); response = serverError(); } return response; }
private Response postSubjectSchema(String subjectName, String schemaText) throws IOException { WebTarget subjectsTarget = rootTarget.path("/subjects/" + subjectName + "/versions"); SchemaString schemaString = new SchemaString(); schemaString.setSchema(schemaText); return subjectsTarget.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(schemaString)); }