91 lines
2.2 KiB
YAML
91 lines
2.2 KiB
YAML
openapi: 3.0.0
|
|
info:
|
|
title: SF NFC Server API
|
|
description: API for managing NFC card activation codes.
|
|
version: 1.0.0
|
|
servers:
|
|
- url: http://localhost:3000
|
|
description: Local development server
|
|
|
|
paths:
|
|
/health:
|
|
get:
|
|
summary: Health check
|
|
responses:
|
|
'200':
|
|
description: Server is healthy
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
ok:
|
|
type: boolean
|
|
|
|
/nfc/generate:
|
|
post:
|
|
summary: Generate an activation label for an NFC card
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/GenerateLabelRequest'
|
|
responses:
|
|
'200':
|
|
description: Label generated or reused successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/CodeGenerationResult'
|
|
'422':
|
|
description: Validation error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ErrorResponse'
|
|
'500':
|
|
description: Internal server error
|
|
|
|
components:
|
|
schemas:
|
|
GenerateLabelRequest:
|
|
type: object
|
|
required:
|
|
- cardId
|
|
properties:
|
|
cardId:
|
|
type: string
|
|
description: Unique identifier for the NFC card
|
|
override:
|
|
type: boolean
|
|
description: Whether to force generation of a new code even if one exists
|
|
default: false
|
|
|
|
CodeGenerationResult:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: string
|
|
description: The activation code
|
|
label:
|
|
type: string
|
|
description: The generated label content (e.g., HTML/SVG)
|
|
overriden:
|
|
type: boolean
|
|
description: True if an existing code was overridden
|
|
reused:
|
|
type: boolean
|
|
description: True if an existing code was reused
|
|
|
|
ErrorResponse:
|
|
type: object
|
|
properties:
|
|
error:
|
|
type: object
|
|
properties:
|
|
msg:
|
|
type: string
|
|
field:
|
|
type: string
|