Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
> acceptance are aligned for an actual 0.3.0 publication.

### Changed
- development 프로필의 Swagger UI에서 `persistAuthorization`을 활성화해 입력한 authorization 상태를 새로고침 이후에도 유지합니다. production 프로필은 Swagger UI 기본값(`false`)을 유지합니다.
- `/parse`를 언어 선택형 파서로 일반화: MinerU `-l japan`/`-m ocr` 하드코딩을 제거하고 optional form 필드 `language`(MinerU 3.4.4 공식 기본 `ch`, 공개 언어군/alias 검증)와 `mode`(`auto`/`ocr`/`txt`, 기본 `auto`)로 파라미터화. `mode=auto`는 born-digital PDF가 강제 OCR을 건너뛰도록 함. 기존 입력 `language=japan&mode=ocr`는 공식 규약대로 `ch`/`ocr`로 정규화됨.
- OpenAPI 제목/설명, README, `ArticleNode.headline` 문서를 일반 문서용 (section heading) 표현으로 재구성하여 특정 언어/신문 가정을 소비자에게 노출하지 않도록 함. 응답 스키마 필드는 하위 호환을 위해 변경하지 않음.

Expand Down
5 changes: 5 additions & 0 deletions src/newsdom_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ def create_app(
"displayRequestDuration": True,
"syntaxHighlight.theme": "monokai",
"tryItOutEnabled": True,
**(
{"persistAuthorization": True}
if application_settings.runtime_profile.value == "development"
else {}
),
},
)
application.state.runtime_settings = application_settings
Expand Down
25 changes: 25 additions & 0 deletions tests/test_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,28 @@ def test_openapi_metadata_includes_contact_and_license():
"name": "MIT License",
"identifier": "MIT",
}


def test_openapi_swagger_ui_parameters_in_production():
from newsdom_api.main import create_app
from newsdom_api.config import RuntimeSettings, RuntimeProfile

app_prod = create_app(
RuntimeSettings(runtime_profile=RuntimeProfile.PRODUCTION, api_token="secret")
)
params = app_prod.swagger_ui_parameters
assert params.get("persistAuthorization") is None


def test_openapi_swagger_ui_persists_authorization_in_authenticated_development():
from newsdom_api.config import RuntimeProfile, RuntimeSettings
from newsdom_api.main import create_app

app_dev = create_app(
RuntimeSettings(
runtime_profile=RuntimeProfile.DEVELOPMENT,
api_token="development-secret",
)
)
params = app_dev.swagger_ui_parameters
assert params.get("persistAuthorization") is True
Loading