JSON Schema Draft-07 · มาตรฐานข้อมูลรายวิชา 356290

โครงสร้าง JSON Schema และข้อมูลพิกัดฟาร์ม

ตรวจสอบมาตรฐานโครงสร้างข้อมูล พิกัด Lat/Long ข้อมูลติดต่อ และดาวน์โหลดไฟล์ JSON ล่าสุดไปใช้งาน

ตารางสรุปโครงสร้างฟิลด์ตาม JSON Schema

ฟิลด์ (JSON Path)ชนิดและข้อกำหนดความจำเป็นคำอธิบาย
courseCodestring (const: "356290")บังคับรหัสรายวิชาฝึกงาน 2
versioninteger (>= 1)บังคับเลขเวอร์ชันที่เพิ่มขึ้นทุกครั้งเมื่อ Admin Commit ข้อมูล
farms[].idstring (^[A-Za-z0-9_-]+$)บังคับรหัสเฉพาะของฟาร์มฝึกงาน ห้ามซ้ำกัน
farms[].namestring (minLength: 2)บังคับชื่อฟาร์มหรือศูนย์วิจัยปศุสัตว์
farms[].categoryenum (7 หมวดหมู่)บังคับหน่วยแปรรูปฯ, ฟาร์มสุกร, ฟาร์มสัตว์ปีก, ฟาร์มโคนม โคเนื้อ, ฟาร์มแพะ แกะ และแปลงหญ้า, ฟาร์มสัตว์น้ำ, อื่น ๆ
farms[].customCategorystringเมื่อเลือก "อื่น ๆ"ระบุชื่อประเภทฟาร์มเพิ่มเติมเองกรณีเลือกหมวดหมู่ "อื่น ๆ"
farms[].coordinates.latnumber (-90 ถึง 90)บังคับพิกัดละติจูด WGS84 สำหรับปักหมุดบนแผนที่
farms[].coordinates.lngnumber (-180 ถึง 180)บังคับพิกัดลองจิจูด WGS84 สำหรับปักหมุดบนแผนที่
farms[].addressobject (subdistrict, district, province, postalCode)บังคับที่ตั้งครบถ้วนพร้อมรหัสไปรษณีย์ 5 หลัก (รองรับ Auto-fill)
farms[].contactobject (coordinatorName?, role?, phone?, email?, lineId?)ไม่บังคับข้อมูลผู้ประสานงานฟาร์มและเบอร์โทรศัพท์ติดต่อ (กรอกเพิ่มเติมได้)
farms[].internshipInfoobject (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"
          }
        }
      }
    }
  }
}