feat(api-docs): reintroduce API doc generation (#289)

- reintroduces API doc generation via API_DOCS_ENABLED
- accessible publicly via /api/docs and /api/openapi.json
This commit is contained in:
Zach
2026-04-22 17:26:58 -04:00
committed by Zach Yale
parent 351074fcb6
commit 5ac7b5553e
9 changed files with 102 additions and 4 deletions
@@ -0,0 +1,30 @@
package org.booklore.controller;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.StreamUtils;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import static org.assertj.core.api.Assertions.assertThat;
class ScalarControllerTest {
private final ScalarController controller = new ScalarController();
@Test
void shouldForwardToStaticScalarPage() {
assertThat(controller.scalar()).isEqualTo("forward:/scalar.html");
}
@Test
void staticScalarPageShouldDisableTelemetryAndPointToApiDocs() throws IOException {
String html = StreamUtils.copyToString(
new ClassPathResource("static/scalar.html").getInputStream(),
StandardCharsets.UTF_8
);
assertThat(html).contains("data-url=\"/api/openapi.json\"");
assertThat(html).contains("\"telemetry\":false");
}
}