JSON Schema Draft-07 · มาตรฐานข้อมูลรายวิชา 356290
โครงสร้าง JSON Schema และข้อมูลพิกัดฟาร์ม
ตรวจสอบมาตรฐานโครงสร้างข้อมูล พิกัด Lat/Long ข้อมูลติดต่อ และดาวน์โหลดไฟล์ JSON ล่าสุดไปใช้งาน
ตารางสรุปโครงสร้างฟิลด์ตาม JSON Schema
| ฟิลด์ (JSON Path) | ชนิดและข้อกำหนด | ความจำเป็น | คำอธิบาย |
|---|---|---|---|
| courseCode | string (const: "356290") | บังคับ | รหัสรายวิชาฝึกงาน 2 |
| version | integer (>= 1) | บังคับ | เลขเวอร์ชันที่เพิ่มขึ้นทุกครั้งเมื่อ Admin Commit ข้อมูล |
| farms[].id | string (^[A-Za-z0-9_-]+$) | บังคับ | รหัสเฉพาะของฟาร์มฝึกงาน ห้ามซ้ำกัน |
| farms[].name | string (minLength: 2) | บังคับ | ชื่อฟาร์มหรือศูนย์วิจัยปศุสัตว์ |
| farms[].category | enum (7 หมวดหมู่) | บังคับ | หน่วยแปรรูปฯ, ฟาร์มสุกร, ฟาร์มสัตว์ปีก, ฟาร์มโคนม โคเนื้อ, ฟาร์มแพะ แกะ และแปลงหญ้า, ฟาร์มสัตว์น้ำ, อื่น ๆ |
| farms[].customCategory | string | เมื่อเลือก "อื่น ๆ" | ระบุชื่อประเภทฟาร์มเพิ่มเติมเองกรณีเลือกหมวดหมู่ "อื่น ๆ" |
| farms[].coordinates.lat | number (-90 ถึง 90) | บังคับ | พิกัดละติจูด WGS84 สำหรับปักหมุดบนแผนที่ |
| farms[].coordinates.lng | number (-180 ถึง 180) | บังคับ | พิกัดลองจิจูด WGS84 สำหรับปักหมุดบนแผนที่ |
| farms[].address | object (subdistrict, district, province, postalCode) | บังคับ | ที่ตั้งครบถ้วนพร้อมรหัสไปรษณีย์ 5 หลัก (รองรับ Auto-fill) |
| farms[].contact | object (coordinatorName?, role?, phone?, email?, lineId?) | ไม่บังคับ | ข้อมูลผู้ประสานงานฟาร์มและเบอร์โทรศัพท์ติดต่อ (กรอกเพิ่มเติมได้) |
| farms[].internshipInfo | object (capacity: integer >= 1 | null, hasDormitory, notes?) | บังคับ | จำนวนรับนักศึกษา (ไม่จำกัดจำนวนบน หรือ null = ไม่จำกัด) และหอพัก |
farms.schema.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://internship-356290.local/schemas/farms.schema.json",
"title": "Internship 356290 Farm Directory Schema",
"description": "JSON Schema มาตรฐานสำหรับจัดเก็บพิกัดฟาร์ม สถานที่ฝึกงาน และข้อมูลติดต่อ รายวิชา ฝึกงาน 2 (356290)",
"type": "object",
"additionalProperties": false,
"required": [
"courseCode",
"courseTitle",
"version",
"updatedAt",
"farms"
],
"properties": {
"courseCode": {
"type": "string",
"const": "356290",
"description": "รหัสรายวิชาฝึกงาน 2"
},
"courseTitle": {
"type": "string",
"minLength": 3,
"description": "ชื่อรายวิชา"
},
"version": {
"type": "integer",
"minimum": 1,
"description": "เลขเวอร์ชันของข้อมูลที่ Commit"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"description": "วันเวลาที่อัปเดตล่าสุด (ISO 8601)"
},
"farms": {
"type": "array",
"description": "รายการสถานที่และฟาร์มฝึกงานทั้งหมด",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"name",
"category",
"coordinates",
"address",
"internshipInfo",
"updatedAt"
],
"properties": {
"id": {
"type": "string",
"minLength": 3,
"pattern": "^[A-Za-z0-9_-]+$",
"description": "รหัสอ้างอิงฟาร์ม (เช่น FARM-356290-001)"
},
"name": {
"type": "string",
"minLength": 2,
"description": "ชื่อฟาร์มหรือหน่วยงานฝึกงาน"
},
"category": {
"type": "string",
"enum": [
"หน่วยแปรรูปฯ",
"ฟาร์มสุกร",
"ฟาร์มสัตว์ปีก",
"ฟาร์มโคนม โคเนื้อ",
"ฟาร์มแพะ แกะ และแปลงหญ้า",
"ฟาร์มสัตว์น้ำ",
"อื่น ๆ"
],
"description": "ประเภทฟาร์มหรือสถานที่ฝึกงาน"
},
"customCategory": {
"type": "string",
"description": "ระบุประเภทฟาร์มเพิ่มเติมเมื่อเลือกหมวดหมู่ \"อื่น ๆ\""
},
"coordinates": {
"type": "object",
"additionalProperties": false,
"required": [
"lat",
"lng"
],
"properties": {
"lat": {
"type": "number",
"minimum": -90,
"maximum": 90,
"description": "ค่าละติจูด (Latitude) ระหว่าง -90 ถึง 90"
},
"lng": {
"type": "number",
"minimum": -180,
"maximum": 180,
"description": "ค่าลองจิจูด (Longitude) ระหว่าง -180 ถึง 180"
}
}
},
"address": {
"type": "object",
"additionalProperties": false,
"required": [
"subdistrict",
"district",
"province",
"postalCode"
],
"properties": {
"subdistrict": {
"type": "string",
"minLength": 1
},
"district": {
"type": "string",
"minLength": 1
},
"province": {
"type": "string",
"minLength": 1
},
"postalCode": {
"type": "string",
"pattern": "^[0-9]{5}$",
"description": "รหัสไปรษณีย์ 5 หลัก"
}
}
},
"contact": {
"type": "object",
"additionalProperties": false,
"properties": {
"coordinatorName": {
"type": "string"
},
"role": {
"type": "string"
},
"phone": {
"type": "string"
},
"email": {
"type": "string"
},
"lineId": {
"type": "string"
}
}
},
"internshipInfo": {
"type": "object",
"additionalProperties": false,
"required": [
"capacity",
"hasDormitory"
],
"properties": {
"capacity": {
"type": [
"integer",
"null"
],
"minimum": 1,
"description": "จำนวนรับนักศึกษา (null หมายถึงไม่จำกัดจำนวน)"
},
"hasDormitory": {
"type": "boolean"
},
"notes": {
"type": "string"
}
}
},
"updatedAt": {
"type": "string",
"format": "date-time"
}
}
}
}
}
}