You can use --dry-run flag to test the manifest.
This is really useful not only to ensure if the yaml syntax is right for a particular Kubernetes object but also to ensure that a spec has required key-value pairs.
kubectl create -f <test.yaml> --dry-run
Let us now look at an example Pod spec that will launch an nginx pod
cat example_pod.yaml
---
apiVersion: v1
kind: Pod
metadata:
name: my-nginx
namespace: mynamespace
spec:
containers:
- name: my-nginx
image: nginx
kubectl create -f example_pod.yaml --dry-run
pod/my-nginx created (dry run)