If a question has no answer, the structured data is missing the Schema.org types
Example: question with answer
QAPage item is specified on the
html element, and the
Question item is specified on the
<html itemscope itemtype="http://schema.org/QAPage" class="html__responsive">
<div itemprop="mainEntity" itemscope itemtype="http://schema.org/Question">
Example: question without answer
It has neither the
QAPage type nor the
html element (which would usually carry the
QAPage type) doesn’t create any Microdata item, and the
div element (which would usually carry the
Question type) has no type specified (only
itemtype is specified for the item (that gets created with
itemscope), no vocabulary identifier is prepended to the properties (
upvoteCount etc.). This means that these properties aren’t Schema.org properties (except for the
name that belongs to the
Person, as there the Schema.org type is specified).
That’s why the SDTT says "Unspecified Type", and that’s why it prepends the document’s base URL (
https://stackoverflow.com/) to the properties.
Questiontype defines the question that this page answers, and includes the answers, if any, to that question.
answerCount- Integer - The total number of answers to the question. For example, if there are 15 answers, but only the first 10 are marked up due to pagination, this value would be 15. This may also be 0 for questions with no answers.
For questions without answers, set the
answerCountproperty to 0.
So, the most straightforward fix would be to use the same structured data (that gets used for a question with answer) for a question without answer. The only difference would be to omit the
answerCount: 0 is already provided for a question without answer, as the screenshot above shows)
If, for some reason,
QAPage shouldn’t be used, you could
either use its parent type
QAPage(and everything else stays the same):
<html itemscope itemtype="http://schema.org/WebPage" class="html__responsive"> <div itemprop="mainEntity" itemscope itemtype="http://schema.org/Question">
or omit the page type, and just use
<html class="html__responsive"> <div itemscope itemtype="http://schema.org/Question">