Skip to content

Adds validation View and some code fixes#7

Merged
marmoure merged 25 commits intomainfrom
web/views
Jan 21, 2026
Merged

Adds validation View and some code fixes#7
marmoure merged 25 commits intomainfrom
web/views

Conversation

@marmoure
Copy link
Copy Markdown
Collaborator

@marmoure marmoure commented Dec 31, 2025

This PR primarily Adds the validation web view, but since then this branch diverted more toward the new develop branch.
Here's everything this PR is supposed to deliver:

  1. Web UI for validating broadband label files.
  2. Docker image for running the server.
  3. Update the Open API specs.
  4. Some bug fixes and code improvements based on previous feed back

PS: the review process already started up to this commit 1de92e4

@marmoure marmoure force-pushed the web/views branch 2 times, most recently from a534aa6 to e14dc2a Compare January 5, 2026 12:27
Comment thread src/test/resources/application-test.yml Outdated
mock-data:
enabled: true
mapping: "/mock-data/**"
paths: "classpath:schemas"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please rename the actual folder src/test/resources/schemas to mock-data please?

request,
HttpResponse.BodyHandlers.ofInputStream()
);
try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make variable as final please

);
try (CloseableHttpResponse response = httpClient.execute(httpGet)) {

int statusCode = response.getStatusLine().getStatusCode();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark variable as final please


try (InputStream inputStream = response.body()) {
Files.copy(inputStream, tempFile, StandardCopyOption.REPLACE_EXISTING);
try (InputStream inputStream = response.getEntity().getContent()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark variable as final please

.followRedirects(HttpClient.Redirect.NORMAL)
this.poolingHttpClientConnectionManager = new PoolingHttpClientConnectionManager();

this.httpRequestConfig = RequestConfig.custom()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need:

poolingHttpClientConnectionManager.setMaxTotal(20);
poolingHttpClientConnectionManager.setDefaultMaxPerRoute(15);
poolingHttpClientConnectionManager.setValidateAfterInactivity(15_000);

.setConnectionRequestTimeout(3_000)
.build();

this.httpClient = HttpClients
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to build a new client for each request - this should not be in the constructor, it needs to be done in downloadToTemp - see the https://github.com/evolvedbinary/expath-package-repository-plugin/blob/main/src/main/java/com/evolvedbinary/maven/plugins/expath/pkg/repository/ResolveMojo.java as an example

Comment thread pom.xml
<artifactId>micronaut-reactor</artifactId>
<version>3.9.1</version>
</dependency>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is just an example - please remove this commit or merge it into the final relevant view commit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you delete this commit from the history, when doing a git interactive rebase, your following commit (6540ac7) that removes this should be automatically skipped and excluded

@View("validate")
@Get("/validate")
public Map<String, Object> validate() {
Map<String, Object> model = new HashMap<>();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mark all variables, parameters, and class fields as final where possib;e

@Post(value = "/validate", consumes = MediaType.APPLICATION_FORM_URLENCODED)
public Map<String, Object> validateSubmit(@Body Map<String, String> formData) {
String schemaId = formData.get("schemaId");
String csvContent = formData.get("csvContent");
Copy link
Copy Markdown
Member

@adamretter adamretter Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If required parameters are not present, this should generate a BadRequest, or if going back to a HTML page then it should alert the user to the error

// }

try {
Path tempFile = fileDownloadService.saveContentToTemp(csvContent);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to delete/close any temporary resources that you own once you are finished with them! e.g. tempFile here.

Comment thread src/main/resources/application.yml Outdated
version: ${project.version}
schema:
directory: schemas No newline at end of file
directory: C:\Users\x\Documents\bbl-validator\src\main\resources\schemas No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be hard-coded to your local environment


try {
Path tempFile = fileDownloadService.saveContentToTemp(csvContent);
Path tempFile = isUrl ? fileDownloadService.downloadToTemp(csvUrl) : fileDownloadService.saveContentToTemp(csvContent);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to cleanup your temporary resources

Comment thread src/main/resources/views/validate.vm Outdated
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
<title>BBL Validator</title>
<style>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels to me that this would be better in a seperate .css file that is <link from here please

Comment thread src/main/resources/application.yml Outdated
static-resources:
default:
enabled: true
mapping: "/**"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change mapping to from /** -> /static/**

Comment thread src/main/resources/views/validate.vm Outdated
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
<link rel="stylesheet" href="/css/simple.min.css">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/static/css/simple.min.css

Comment thread Dockerfile Outdated
@@ -0,0 +1,49 @@
# Builder stage
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add docker-maven-plugin to your pom.xml (see: https://github.com/evolvedbinary/elemental/blob/main/exist-docker/pom.xml#L276)

You can then template this Dockerfile, using Maven by moving it into src/main/resources - you can then use Maven Variables in your Dockerfile for the version number and anything else you need.

When you then run maven package it will also build your Docker image for you.

Comment thread Dockerfile Outdated
FROM eclipse-temurin:21-jre-alpine

# metadata
LABEL maintainer="Evolved Binary <https://www.evolvedbinary.com>"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,322 @@
openapi: 3.1.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should serve this as a static file, from our view page - we should have a link to view our API documentation - either "YAML"(link to the static file) or "Swagger" (link to the remote Swagger OpenAPI spec we built)

Comment thread src/main/resources/static/openapi.yaml Outdated
@@ -81,8 +81,8 @@ paths:
schema:
type: string
description: The CSV Schema
'404':
$ref: '#/components/responses/NotFound'
'400':
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no such resource - that is a 404 not a 400, please fix.

Comment thread src/main/resources/static/openapi.yaml Outdated
executionTime:
type: number
format: double
executionTimeMs:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the code not the label in the OpenAPI spec please

Comment thread src/main/resources/static/openapi.yaml Outdated
type: boolean
description: True if the Boradband Label file validated against the Schema, false otherwise
failures:
description: True if the CSV file is valid UTF-8 encoded
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSV file -> Broadband Label file

Comment thread src/main/resources/static/openapi.yaml Outdated
description: True if the Boradband Label file validated against the Schema, false otherwise
failures:
description: True if the CSV file is valid UTF-8 encoded
errors:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this back to how it was.

Comment thread src/main/resources/static/openapi.yaml Outdated

ValidationFailure:
ValidationError:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename this back

Comment thread src/main/resources/static/openapi.yaml Outdated
type: object
required:
- line
- column
- lineNumber
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the code here and not the schema

@marmoure marmoure force-pushed the web/views branch 4 times, most recently from ef83bb0 to 9ca3b38 Compare January 10, 2026 09:07
@marmoure marmoure changed the title Adds validation API route and view, tests Adds validation View and some code fixes Jan 21, 2026
@marmoure marmoure merged commit fb8a86b into main Jan 21, 2026
1 check passed
@marmoure marmoure deleted the web/views branch January 30, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants